关键词:
XmlSerializer
StreamWriter
保存xml文件
代码:
public static void SaveXML<T>(string xmlFilePath, T instance) { XmlSerializer xs = new XmlSerializer(typeof(T)); StreamWriter sw = new StreamWriter(xmlFilePath); xs.Serialize(sw,instance); sw.Close(); }
时间: 2024-10-13 07:36:54