silverlight中WCF不能传递List<string>
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是两个不同的框架,解决: