Exemple #1
0
        public static AppSettings Load(string filename)
        {
            if (!File.Exists(filename))
                throw new FileNotFoundException(filename);

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.Load(filename);

            XmlConverter xmlConverter = new XmlConverter();
            ConversionContext context = new ConversionContext { Culture = Culture.Invariant, Device = xmlDocument };

            AppSettings settings = xmlConverter.ConvertFrom(xmlDocument, context) as AppSettings;

            return settings;
        }