public static ModuleSettings GetSettings() { ModuleSettings result = null; XmlSerializer xmlSerializer = new XmlSerializer(typeof(ModuleSettings)); try { string startupPath = Application.StartupPath; string path = startupPath + "\\config.xml"; FileStream fileStream = new FileStream(path, FileMode.Open); result = (ModuleSettings)xmlSerializer.Deserialize(fileStream); fileStream.Close(); } catch { result = new ModuleSettings(); } return(result); }