[Serializable] public class MyClass { // put properties and methods here // static method to serialize the class public static string GetString(MyClass message) { XmlSerializer x = new XmlSerializer(typeof(MyClass)); using (StringWriter sw = new StringWriter()) { x.Serialize(sw, message); return sw.ToString(); } } // static method to de-serialize the class public static MyClass GetObject(string xml) { MyClass message = null; try { StringReader sr = new StringReader(xml); XmlSerializer x = new XmlSerializer(typeof(MyClass)); message = (MyClass)x.Deserialize(sr); } catch { } return message; } }Pretty easy, huh?