using System; using System.Collections.Generic; using System.Xml.Serialization; public class Test { public static void Main() { Document d = new Document(); d.Placemarks = new List(); d.Placemarks.Add(new Placemark("Mark" + d.Placemarks.Count, "What I am...")); d.Placemarks.Add(new Placemark("Mark" + d.Placemarks.Count, "What I am...")); d.Placemarks.Add(new Placemark("Mark" + d.Placemarks.Count, "What I am...")); d.Name = "Test.xml"; XmlSerializer x = new XmlSerializer(typeof(Document)); x.Serialize(System.Console.Out, d); } } public class Document { [XmlElement("name")] public string Name { set; get; } [XmlElement("open")] public int Open { set; get; } //This will Serialize to a container ... public List Placemarks { set; get; } } public class Placemark { public Placemark() { } public Placemark(string name, string desc) { Name = name; Description = desc; } [XmlElement("name")] public string Name { set; get; } [XmlElement("description")] public string Description { set; get; } }