How to rename XML attribute that generated after serializing List of objects
The most reliable way is to declare an outermost DTO class: [XmlRoot(“myOuterElement”)] public class MyOuterMessage { [XmlElement(“item”)] public List<TestObject> Items {get;set;} } and serialize that (i.e. put your list into another object). You can avoid a wrapper class, but I wouldn’t: class Program { static void Main() { XmlSerializer ser = new XmlSerializer(typeof(List<Foo>), new XmlRootAttribute(“Flibble”)); … Read more