generic_cloud_storage_client.MySettings.Load C# (CSharp) Méthode

Load() public static méthode

load if not curropted if curropted file do not hang check the catch block and close the file and load again with defualt settings
public static Load ( ) : MySettings
Résultat MySettings
        public static MySettings Load()
        {
            if (!File.Exists(SettingsFile))
                return DefaultSettings;
                 using(Stream _Stream = File.OpenRead(SettingsFile))

                 {
                     try{

                    XmlSerializer _Object=new XmlSerializer(typeof(MySettings));

                     return (MySettings)_Object.Deserialize(_Stream);
                 }
                     catch (InvalidOperationException)
                     {
                         _Stream.Close();
                         File.Delete(SettingsFile);
                         return DefaultSettings;
                     }

                 }
        }
MySettings