G
Guest
Hi all,
I want to control element name of a collection in XML serialization,
[Serializable()]
public class MatchedServiceItem {
[XmlArrayItem(ElementName = "ServiceList")]
public List<int[]> MatchedServiceIDs;
}
Then I get following result
<?xml version="1.0" encoding="utf-8"?>
<Setting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MatchedServiceItems>
<MatchedServiceItem>
<MatchedServiceIDs>
<ServiceList>
<int>1</int>
<int>2</int>
</ServiceList>
<ServiceList>
<int>1000</int>
</ServiceList>
</MatchedServiceIDs>
<MatchedServiceText>Match A</MatchedServiceText>
</MatchedServiceItem>
</MatchedServiceItems>
</Setting>
Now how can I furtuer control element name of int[] (nested within
List<int[]>)?
Thanks in advance!
I want to control element name of a collection in XML serialization,
[Serializable()]
public class MatchedServiceItem {
[XmlArrayItem(ElementName = "ServiceList")]
public List<int[]> MatchedServiceIDs;
}
Then I get following result
<?xml version="1.0" encoding="utf-8"?>
<Setting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MatchedServiceItems>
<MatchedServiceItem>
<MatchedServiceIDs>
<ServiceList>
<int>1</int>
<int>2</int>
</ServiceList>
<ServiceList>
<int>1000</int>
</ServiceList>
</MatchedServiceIDs>
<MatchedServiceText>Match A</MatchedServiceText>
</MatchedServiceItem>
</MatchedServiceItems>
</Setting>
Now how can I furtuer control element name of int[] (nested within
List<int[]>)?
Thanks in advance!