无法隐式转换类型...到ArrayOfStrings
问题: 我已经使用了WSDL 其中一个值是type:tns:ArrayOfStrings 我该怎么写呢? 无论我做什么,我得到"不能隐式转换类型...到ArrayOfStrings" 我尝试了以下内容: 并且: 始终出现相同的错误:无法隐式转换....
跨度>
跨度>
问题:如何在这种情况下写入字符串数组???
您使用了服务引用,然后:}当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...