Skip to main content
Code Review

Return to Revisions

3 of 3
replaced http://stackoverflow.com/ with https://stackoverflow.com/

I don't do much , but if this StackOverflow answer applies then you could just do this:

using Settings = MyProject.Namespace.Properties.Settings;
var loadedCode = Settings.Default.LoadedCode;

Like this other StackOverflow answer is saying:

We prefer to use Properties.Settings (aka. settings.settings) because it's strongly typed.

Now I know for a fact that this works with an app.config, but it might not work with a web.config file... but I think it's worth trying.


Alternatively, this Haacked article describes how to use the configuration API to define your own ConfigurationSection classes, which would be the ultimate way to address this issue. Might be overkill if the above works though.

Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467
default

AltStyle によって変換されたページ (->オリジナル) /