xml序列化与反序列化
using System.Xml.Serialization;
//--将对象sm序列化成二进制流
ScheduleMethod sm = new ScheduleMethod();
MemoryStream s = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(sm.GetType());
serializer.Serialize(s, sm);
byte[] file = s.ToArray();
//从数据库获得二进制流并转换成sm对象
entity.ScheduleEntity sch = deviceMAN.GetModelSchedule(scheduleid);
MemoryStream m = new MemoryStream(sch.RecurrenceMethod);
ScheduleMethod sm=(ScheduleMethod)serialzer.Deserialize(m);