private void kryptonButton1_Click_2(object sender, EventArgs e) { Dictionary> dict = new Dictionary>(); dict.Add("test", new List() { "t", "b" }); System.IO.StringWriter xmlString = new System.IO.StringWriter(); using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(xmlString)) { System.Runtime.Serialization.DataContractSerializer serializer = new System.Runtime.Serialization.DataContractSerializer(dict.GetType()); serializer.WriteObject(writer, dict); Console.WriteLine(xmlString.ToString().Length); } }