silverlight中WCF不能传递List<string>

时间:2014-05-01 19:54:53   收藏:0   阅读:590

SL:
List<string> Dishes = ...;
ServiceReference1.Service1Client myClient = new Service1Client();
myClient.MakeOrderAsync(Dishes);

WEB:
[OperationContract]
public Boolean MakeOrder(List<string> dishes)
{
   ...
   return true;
}  

 

提示:

错误 6 与“OrderingDishs.ServiceReference1.Service1Client.MakeOrderAsync(System.Collections.ObjectModel.ObservableCollection<string>)”最匹配的重载方法具有一些无效参数 E:\C#.net\Silverlight初探\OrderingDishs\OrderingDishs\ViewModels\MianWindowViewModel.cs 97 13 OrderingDishs

错误 7 参数 1: 无法从“System.Collections.Generic.List<string>”转换为“System.Collections.ObjectModel.ObservableCollection<string>” E:\C#.net\Silverlight初探\OrderingDishs\OrderingDishs\ViewModels\MianWindowViewModel.cs 97 37 OrderingDishs

这是因为SL的WEB服务端.net CLR和客户端.net是两个不同的框架,解决:
mamicode.com,码迷
mamicode.com,码迷

silverlight中WCF不能传递List<string>,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!