无法隐式转换类型...到ArrayOfStrings [英] Cannot implicitly convert type... to ArrayOfStrings
问题描述
问题: 我已经使用了WSDL 其中一个值是type:tns:ArrayOfStrings 我该怎么写呢? 无论我做什么,我得到"不能隐式转换类型...到ArrayOfStrings" 跨度> 我尝试了以下内容: 跨度> 并且: 始终出现相同的错误:无法隐式转换.... < span style ="font-size:11pt; FONT-FAMILY:宋体;背景色:透明;垂直对齐:基线; white-space:pre-wrap">
问题:如何在这种情况下写入字符串数组???
推荐答案
您使用了服务引用,然后:}当svcutil工具针对WSDL运行,WSDL返回一个通用数组类型,它将它转换为强类型类(在你的例子中是ArrayOfStrings)。你应该能够直接创建这种类型的实例,但是
已经很长了因为我不得不这样做,所以我不记得确切的代码。看看ArrayOfStrings的定义,找出可用的方法。
You used a service reference then :} When the svcutil tool runs against a WSDL that returns a generic array type it converts it to a strongly typed class (ArrayOfStrings in your case). You should be able to create an instance of this type directly but it has been a long time since I've had to do that so I don't remember the exact code. Take a look at the definition of ArrayOfStrings to identify what methods are available to you.
string[] tLabel = new [] { "tl" };
string[] createText = new [] { "Hello", "And", "Welcome" };
//I think this should work
scm.trackLabel = tLabel;
//But if trackLabel is ArrayOfStrings then you'd do something like this
scm.trackLabel = new ArrayOfStrings();
//Cannot remember how to get the elements into the array though...
这篇关于无法隐式转换类型...到ArrayOfStrings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!