using System.Collections.Generic;
using System.Xml.Serialization;
public string Name { get; set; }
public VariableList<Item> Stuff { get; set; }
return new Item[] {new Item() { Name = "1", Value = "111"}, new Item() { Name = "2", Value = "222"}};
public string Name { get; set; }
public string Value { get; set; }
[XmlRoot("NewGroupName")]
public sealed class VariableList<T> : List<T>
public new List<T> Items {get; set;}
public new bool IsNull { get { return Items == null; } }
public new bool IsEmpty { get { return IsNull || Count <= 0; } }
public new int Count { get { return IsNull ? 0 : this.Items.Count; } }
public new string CountAsString { get { return Count.ToString(); } }
var choobakka = new Choobakka() { Name = "CHOO-BAKKA", Stuff = new VariableList<Item>() };
choobakka.Stuff.Items.Add( new Item() { Name = "passport", Value = "lv" } );
choobakka.Stuff.Items.Add( new Item() { Name = "wallet", Value = "50euro" } );
StringBuilder sb = new StringBuilder();
using (var writer = new StringWriter(sb))
var xs = new XmlSerializer(typeof(Choobakka));
xs.Serialize(writer, choobakka);
Console.WriteLine(writer);