Search code examples
c#.netuser-inputproperties.settings

Properties.Settings.Default.Reset() not reflected immediately -Needs Restart


On pressing a Button i reset the user stored settings like this

        Properties.Settings.Default.Reset();

But upon checking for stored data after the reset,the data still exists

outputdir = Properties.Settings.Default.OutputFolder;
            {
              if (outputdir.Length > 0)
              {
               //Data still exists 
              }
            }

The data seems to get cleared only after program restart.How can i force delete user saved settings without restart.


Solution

  • Use below snippet:

     Properties.Settings.Default.Reset();
     Properties.Settings.Default.Save();