自定义类序列化成xml,并获得xml内容
using System.Xml.Serialization;
//--序列化到XML
MemoryStream s = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(sm.GetType());
//将类sm序列化到s中
serializer.Serialize(s, sm);
//依次读取s里的内容
string inputString = System.Text.Encoding.Default.GetString(s.ToArray());