我从Java客户端的可用wsdl中执行WCF SOAP服务,并使用XmlSerializerFormat。 Xml请求看起来像这样
<ArrayOfAnyType Xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<anyType xsi:type="xsd:int">100</anyType>
<anyType xsi:type="xsd:int">200</anyType>
<anyType xsi:type="xsd:int">300</anyType>
</ArrayOfAnyType>
是否保证XmlSerializerFormat,那个数组元素ArrayOfAnyType与Xml中的顺序相同?
这段代码总能给我100,200,300吗?
foreach(var item in ArrayOfAnyType)
{
Console.WriteLine((int)item);
}
答案 0 :(得分:0)
是的,在反序列化XML时,XmlSerializer将维护数组的顺序(包括AnyType)(顺序对XML和数组都很重要)。