答案 0 :(得分:2)
这是我用来序列化到我的对象的代码o
XmlSerializerNamespaces XSN = new XmlSerializerNamespaces();
XSN.Add("", "");
XmlWriterSettings XWS = new XmlWriterSettings();
XWS.OmitXmlDeclaration = true;
StringBuilder XmlStr = new StringBuilder();
XmlSerializer x = new XmlSerializer(o.GetType());
x.Serialize(XmlTextWriter.Create(XmlStr, XWS), o, XSN);