C# WCF:发送多个同名参数
我想通过GET-to-my WCF服务发送相同类型项目的列表。 例如:C# WCF:发送多个同名参数,c#,asp.net,wcf,get,C#,Asp.net,Wcf,Get,我想通过GET-to-my WCF服务发送相同类型项目的列表。 例如: MySite.com?MyService.svc\MyMethod?Id=1&Id=2&Id=3 ..... 还有我的方法 [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] public void MyMethod( ???????? ) { //here i want to get the list of all t
MySite.com?MyService.svc\MyMethod?Id=1&Id=2&Id=3 .....
还有我的方法
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public void MyMethod( ???????? )
{
//here i want to get the list of all the id's i've sent
}
或者可能有另一种方式发送这样的数据,我的意思是,一个随机长度的Id数组
UPD:
我尝试了一个列表和字符串[],不管怎样,它是字符串是的,但异常是:“type”System.string[]”不能被“QueryStringConverter”转换。您可以尝试使用params关键字。比如:
public void MyMethod(params object[] list)
{
// access by index like list[0] etc.
}
如果需要,可以使用int或string代替对象类型u
您可以在上阅读有关参数的更多信息。我尝试了一个列表和字符串[]无论如何,它是字符串是的,但异常是:“type”System.string[]”不能通过“QueryStringConverter”转换。“谢谢,但我仍然有一个错误,如。。。有一个名为“list”的查询变量,其类型为“System.Object[]”,但类型为“System.Object[]”不能由“QueryStringConverter”转换。@V319 mb此主题将对您有所帮助