How to serialize a dictionary with NETXPF:

 

SerializableDictionary dict = new SerializableDictionary();
dict.Add("key1", "value1");
dict.Add("key2", (object)3.14);
StringWriter sw = new StringWriter();
XmlSerializer xs = new XmlSerializer(typeof(SerializableDictionary));
xs.Serialize(sw, dict);
Console.Write(sw.ToString()); //writes the XML to the console

Last edited Oct 25, 2010 at 7:05 AM by dacris, version 2

Comments

No comments yet.