ReturnReportEntity reportEntity = new ReturnReportEntity();
//序列化
XmlSerializer ser = new XmlSerializer(reportEntity.GetType());
string mapth = Server.MapPath("Script/Report.xml");
ser.Serialize(new FileStream(mapth, FileMode.Create), reportEntity);
//反序列化
ReturnReportEntity reportEntity = new ReturnReportEntity();
string mapth = Server.MapPath("Script/Report.xml");
XmlSerializer ser = new XmlSerializer(reportEntity.GetType());
reportEntity = (ReturnReportEntity)ser.Deserialize(new FileStream(mapth, FileMode.Open));
XML序列化和反序列化
最新推荐文章于 2023-01-28 08:02:58 发布