You can serialize the object using the following code
public static string Serialize<t>(object obj)
{
StringBuilder sb = new StringBuilder();
using (TextWriter writer = new StringWriter(sb))
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
var serializer = new XmlSerializer(typeof(T));
serializer.Serialize(XmlWriter.Create(writer, settings), obj);
}
string form = sb.ToString();
return form;
}