static void Main() { MyResponse resp = new MyResponse(); resp.StartIndex = 1; resp.Entries.Add(new Person { Name = "meeee" }); resp.Entries.Add(new Person { Name = "youuu" }); XmlSerializer ser = new XmlSerializer(resp.GetType()); ser.Serialize(Console.Out, resp); }