using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Xml.Serialization; namespace TransportGame.Utils { public static class XmlHelper { /// /// Deserializes a file /// /// Type to deserialize /// File name /// Deserialized object public static T Deserialize(string filename) { XmlSerializer serializer = new XmlSerializer(typeof(T)); var stream = new StreamReader(filename); return (T)serializer.Deserialize(stream); } } }