开发者

Add User Settings at runtime in a c# application

I want to add new settings to开发者_JAVA技巧 the user.config at runtime for a C# application (WPF). These settings will be added by independent modules so I have no idea what they will be in advance.

Most examples refer to:

Configuration config =
    configurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

But this only allows you to access the Application Settings and you can't save it anyway as it's not meant to be modified.

I want to be able to do something like

Settings.Default.Add("SomeKey", "someobject");
Settings.Default.Save()

after which this setting would be available the next time this specific user starts the application.


You may wish to check this solution.

It is doable but it is lots of code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜