public static T LoadFromXML<T>(string path) { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); var f = new System.Xml.Serialization.XmlSerializer(typeof(T)); T obj = (T)f.Deserialize(fs); fs.Close(); return obj; } public static void SaveToXML<T>(T obj, string path) { FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write); var bf = new System.Xml.Serialization.XmlSerializer(typeof(T)); bf.Serialize(fs,obj); fs.Close(); }