static Config() { try { Instance = FromFile(FileName); } catch(FileNotFoundException) { Instance = new Config(); } }
private static void ToFile(string file, Config config) { var xs = new XmlSerializer(typeof(Config)); using(var s = File.OpenWrite(file)) { xs.Serialize(s, config); s.SetLength(s.Position); } }