C#model序列化xml
作者:互联网
private string Serialier<T>(T model) { using (StringWriter streamWriter = new StringWriter()) { XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); XmlSerializer xmlSerializer = new XmlSerializer(model.GetType()); xmlSerializer.Serialize(streamWriter, model,ns); return streamWriter.ToString(); } }
参数model是数据模型
标签:xml,streamWriter,ns,C#,StringWriter,new,model,序列化,xmlSerializer 来源: https://www.cnblogs.com/wangjp-1233/p/11923927.html