Search code examples
c#winformsshortcutproperties.settings

Looking for a shurtcut of Properties.Settings.Default


The more options I have defined, the more a have to type when I have to modify them. So I'm looking for a shorter version of Properties.Settings.Default.varX

I tried:

Properties.Settings settings = Properties.Settings.Default;
settings.var1 = "x";
settings.var2 = "y";
settings.var3 = "Z";
Properties.Settings.Default = settings;

but Properties.Settings.Default is read-only and the Save function has no overload.

So is there any other way than typing Properties.Settings.Default again and again?


Solution

  • Just try it like this:

    Properties.Settings settings = Properties.Settings.Default;
    settings.var1 = "x";
    settings.var2 = "y";
    settings.var3 = "Z";
    settings.Save();