Browse Source

Improve AppSettings slightly

Antony Male 9 years ago
parent
commit
fd518c33cf
1 changed files with 1 additions and 2 deletions
  1. 1 2
      src/SyncTrayzor/Services/Config/AppSettings.cs

+ 1 - 2
src/SyncTrayzor/Services/Config/AppSettings.cs

@@ -23,13 +23,13 @@ namespace SyncTrayzor.Services.Config
     public class AppSettings
     public class AppSettings
     {
     {
         private const string sectionName = "settings";
         private const string sectionName = "settings";
+        private static readonly XmlSerializer serializer = new XmlSerializer(typeof(AppSettings), new XmlRootAttribute(sectionName));
 
 
         public static readonly AppSettings Instance;
         public static readonly AppSettings Instance;
 
 
         static AppSettings()
         static AppSettings()
         {
         {
             var reader = (XmlReader)ConfigurationManager.GetSection(sectionName);
             var reader = (XmlReader)ConfigurationManager.GetSection(sectionName);
-            var serializer = new XmlSerializer(typeof(AppSettings), new XmlRootAttribute(sectionName));
             Instance = (AppSettings)serializer.Deserialize(reader);
             Instance = (AppSettings)serializer.Deserialize(reader);
         }
         }
 
 
@@ -51,7 +51,6 @@ namespace SyncTrayzor.Services.Config
 
 
         public override string ToString()
         public override string ToString()
         {
         {
-            var serializer = new XmlSerializer(typeof(AppSettings));
             using (var writer = new StringWriter())
             using (var writer = new StringWriter())
             {
             {
                 serializer.Serialize(writer, this);
                 serializer.Serialize(writer, this);