Example :
1.When i using program start int x = 5;
2.Do something until x = 10
3.Closing program
4.When a relaunch program x will be equal to 10 (not 5)
Example :
1.When i using program start int x = 5;
2.Do something until x = 10
3.Closing program
4.When a relaunch program x will be equal to 10 (not 5)
Here the Application Setting will come into play.
Proiperties -> Settings
This will strore our data as XMl formatted.
Action can be applied through both programmatically and manually.
Programmatically:
Create:
SettingsProperty property = new SettingsProperty(nameofthesetting);
property.DefaultValue = "Default";
property.IsReadOnly = false;
property.PropertyType = typeof(bool);
property.Provider = Properties.Settings.Default.Providers["LocalFileSettingsProvider"];
property.Attributes.Add(typeof(UserScopedSettingAttribute), new UserScopedSettingAttribute());
Properties.Settings.Default.Properties.Add(property);
Properties.Settings.Default.Reload();
property.DefaultValue = HereYourValue;
Update :
Settings.Default.YourSettingsName=NewValue
Settings.Default.Save();
Settings.Default.Reload();
reference,
How do I get around application scope settings being read-only?