[ACCEPTED]-How to deserialize into a List<String> using the XmlSerializer-xml-serialization

Accepted answer
Score: 50

Add a property like this to hold the list 5 of Components:

[XmlArray()]
public List<Component> Components { get; set; }

Edit: Sorry I misread that. You 4 want to read it into a collection of strings. I 3 just tried this below and it worked on your 2 sample. The key is just to setup the correct 1 xml serialization attributes.

public class ArsAction
{
    [XmlArray]
    [XmlArrayItem(ElementName="Component")]
    public List<string> Components { get; set; }
}

More Related questions