标签:des blog ar for div log ad new as
public static T GetEntityByXml<T>(string xml, string rootNode=null) where T : new() { if (string.IsNullOrEmpty(xml)) return new T(); if (!string.IsNullOrEmpty(rootNode)) { xml = string.Format("<{0}>{1}</{0}>", rootNode, xml); } using (TextReader reader = new StringReader(xml)) { var serializer = new XmlSerializer(typeof(T)); return (T)serializer.Deserialize(reader); } }
标签:des blog ar for div log ad new as
原文地址:http://www.cnblogs.com/Wolfmanlq/p/4039695.html