webservice不理解数据类型 [英] Datatype not understood by webservice

查看:104
本文介绍了webservice不理解数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我用类似的方法创建了一个Web服务界面,



Hi,

I have created a web service interface with method like,

[OperationContract]

       
        string Log(string COMMENTS, string product, Dictionary<string, List<string>> analysisComp);





这里的问题是如果我尝试使用这个web服务并尝试将值传递给Dictionary< string,List< string>>变量它给我以下错误:





The issue here is if i try to consume this webservice and try to pass the values to Dictionary <string , List<string>> variable it gives me the following error:

cannot convert from 'System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>>' to ArrayOfKeyValueOfstringArrayOfstringty7Ep6D1KeyValueOfstringArrayOfstringty7Ep6D1[]	





如果我不能在我的webservice方法中使用Dictionary的这种数据类型,请指教什么是最好的替代品..



谢谢,



我是什么尝试过:



创建Web服务,但Dictionary的数据类型不接受。



CAn you please advise if i cant use this datatype of Dictionary in my webservice method what would be the best alternate for it..

Thanks,.

What I have tried:

Create Web service but datatype of Dictionary is not accepting.

推荐答案

尝试使用它来初始化tyour词典。

Try using this to initialize tyour dictionary.
Dictionary<string, List<string>> analysisComp = new Dictionary<string, List<string>>();
analysisComp.Add("CHEM", new List<string>() { "Water", "Liquid" });
analysisComp.Add("Basse", new List<string>() { "Acid", "Calcium", "Magnesium" });


这篇关于webservice不理解数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆