开发者

How to pass generic KeyValuePair<Tkey,TValue> to a WebMethod?

 [WebMethod]
public void Test(KeyValuePair<string,string> details)
{        
}

I have defined the above web-method.

The KeyValuePair is defined in http://schemas.datacontract.org/2004/07/System.Collections.Generic

how can i add it to my wsdl auto-generated file? i have to define this type because otherwise i get an empty definition in the wsdl file:

<s:complexType name="KeyValuePairOfStringString" /&开发者_如何学Cgt;


For that particular problem, I'd recommend changing the signature to

public void Test(string key, string value) 

as I've never got web services to play nicely with generics. If you have any other methods with similar problems, you can use the auto-generated proxy classes, or pass things in as objects and cast them back within the web method.


I am having this issue too. Looks like i will have to create a specific class(es) for now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜