我创建了一个 WCF 服务并公开了一个接受 List 作为参数的函数。
public bool Execute(string databaseServer, string database, string ClientName, string ERAPayerID, string PlanPriority, List<string> AdjCode, List<string> RemarkCode, List<string> CPT, string Modifier, string renderingProviderNPI)
当我调用这个函数时,它要求我提供 string[] 而不是 List
WriteOffServiceClient client = new WriteOffServiceClient();
bool resutl = client.Execute("server", "database", practiseIdentifier, "", ERAPayerId, pPriority, new List<string>, new List<string>, new List<string>, "", "");
它给了我这个无效参数的错误。当我用字符串调用它时,它接受它。
WriteOffServiceClient client = new WriteOffServiceClient();
bool resutl = client.Execute("server", "database", practiseIdentifier, "", ERAPayerId, pPriority, new string[5], new string[5], new string[5], "", "");
如果我只想接受列表,我该怎么办?
这与您添加服务引用的方式有关。您可以在添加服务引用时选择集合类型。
添加服务参考 -> 输入您的网址,然后使用高级按钮您可以选择System.Collection.Generic.List
收集选项。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句