I’m serializing to XML my class where one of properties has type List<string>.
public class MyClass { ... public List<string> Properties { get; set; } ... }
XML created by serializing this class looks like this:
<MyClass> ... <Properties> <string>somethinghere</string> <string>somethinghere</string> </Properties> ... </MyClass>
and now my question. How can I change my class to achieve XML like this:
<MyClass> ... <Properties> <Property>somethinghere</Property> <Property>somethinghere</Property> </Properties> ... </MyClass>
after serializing. Thanks for any help!
Try XmlArrayItemAttribute:
test.xml: