C# json object互转工具
public static T Deserializer<T>(string path) { try { System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.LoadXml(path); MemoryStream stream = new MemoryStream(); xd.Save(stream); XmlSerializer xml = new XmlSerializer(typeof(T)); //序列化对象 T t = (T)xml.Deserialize(stream); stream.Close(); return t; } catch (InvalidOperationException) { throw; } catch (FileNotFoundException) { throw; } finally { } }