Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 31st, 2013  |  syntax: C#  |  size: 0.71 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         private void kryptonButton1_Click_2(object sender, EventArgs e)
  2.         {
  3.             Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>();
  4.             dict.Add("test", new List<string>() { "t", "b" });
  5.  
  6.             System.IO.StringWriter xmlString = new System.IO.StringWriter();
  7.             using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(xmlString))
  8.             {
  9.                 System.Runtime.Serialization.DataContractSerializer serializer = new System.Runtime.Serialization.DataContractSerializer(dict.GetType());
  10.                 serializer.WriteObject(writer, dict);
  11.  
  12.                 Console.WriteLine(xmlString.ToString().Length);
  13.             }
  14.         }
clone this paste RAW Paste Data