I have the following C # property:
private List<string> _accountTypes; [XmlArray(ElementName = "accountTypes")] public List<string> AccountTypes { get { return _accountTypes; } set { _accountTypes = value; } }
which is initialized as follows in the constructor of the class:
_accountTypes = new List<string>( new string[] { "OHGEE", "OHMY", "GOLLY", "GOLLYGEE" });
When deserializing, I get the following:
<accountTypes> <string>OHGEE</string> <string>OHMY</string> <string>GOLLY</string> <string>GOLLYGEE</string> </accountTypes>
I would like if I could do this:
<accountTypes> <accountType>OHGEE</accountType> <accountType>OHMY</accountType> <accountType>GOLLY</accountType> <accountType>GOLLYGEE</accountType> </accountTypes>
Without creating a subclass like "accountType", how can this be done? Are there any XML attribute properties that can be used to get what I need?
c # xml deserialization xml-serialization
Moe howard
source share