日期:2014-05-17 浏览次数:20777 次
MemoryStream ms = new MemoryStream();
XmlTextWriter xmlWriter = new XmlTextWriter(ms, Encoding.UTF8);
XmlSerializer formatter = new XmlSerializer(typeof(OBj));
formatter.Serialize(xmlWriter, parameters); // OBj parameters; 可xml时 出错
xmlWriter.Close();
string info = Encoding.UTF8.GetString(ms.ToArray());
XmlSerializer xmlSrlzr = new XmlSerializer(typeof(Domain.SoulBaseInfo));
MemoryStream ms = new MemoryStream();
XmlTextWriter xmlWriter = new XmlTextWriter(ms, Encoding.UTF8);
XmlSerializer formatter = new XmlSerializer(typeof(Domain.SoulBaseInfo));
formatter.Serialize(xmlWriter, baseInfo);
xmlWriter.Close();
string info = Encoding.UTF8.GetString(ms.ToArray());
info = info.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "\r\a"); //删除第一行