views:

22

answers:

1

When I create a settings file, Visual Studio generates a singleton with the instance name Default:

Properties.Settings.Default.SettingIHaveSaved

How can I get Visual Studio to generate another list of settings with a new instance name? Say,

Properties.Settings.Debug.SettingIHaveSaved

Thanks!

+1  A: 

You can't get Visual Studio to generate this property but you can easily add this behavior. Settings is implemented as a partial class so you just need to create a new file with another partial declaration and add the property you want there.

For example

internal partial class Settings {
  private static Settings _debugInstance = ApplicationSettingsBase.Synchronized(new Settings());
  internal static Settings Debug { 
    get { return _debugInstance; }
  }
}
JaredPar
I figured I could do this but it takes away use of the Settings interface provided by Visual Studio :/
Jake
@Jake, howso? I've done this technique several times and the settings designer continues to function
JaredPar
@JaredPar How can I use the Settings interface to change the settings used by Settings.Debug? All of the changes made to the interface only affect Settings.Default.
Jake
Apparently you can't. Thanks!
Jake