using System.Reflection.PortableExecutable; using System.Xml.Serialization; namespace WmsMobileServe.Utils; /// /// XML 工具类 /// public class XmlUtils { /// /// 格式化xml字符串到实体类 /// /// /// /// public static T? Deserialize(string xmlString) where T : class { try { using StringReader reader = new(xmlString); XmlSerializer xs = new(typeof(T)); T? ret = xs.Deserialize(reader) as T; return ret; } catch { } return default; } }