示例#1
0
文件: XmlManager.cs 项目: ywscr/NBi
        protected object DeserializeTo(string objectData, Type type, ReadWriteAttributes attr)
        {
            var serializer = new XmlSerializer(type, attr);
            var result     = string.Empty;

            using (var reader = new StringReader(objectData))
                return(serializer.Deserialize(reader));
        }
示例#2
0
文件: XmlManager.cs 项目: ywscr/NBi
        protected string SerializeFrom(object objectData, Type type, ReadWriteAttributes attr)
        {
            var serializer = new XmlSerializer(type, attr);

            using (var writer = new StringWriter())
            {
                serializer.Serialize(writer, objectData);
                return(writer.ToString());
            }
        }
示例#3
0
文件: XmlManager.cs 项目: ywscr/NBi
 protected internal T XmlDeserializeTo <T>(string objectData, ReadWriteAttributes attr)
 => (T)DeserializeTo(objectData, typeof(T), attr);
示例#4
0
文件: XmlManager.cs 项目: ywscr/NBi
 protected internal string XmlSerializeFrom <T>(T objectData, ReadWriteAttributes attr)
 => SerializeFrom(objectData, typeof(T), attr);