How to set app settings without save in c# [duplicate]

孤街浪徒 提交于 2021-02-08 12:13:31

问题


We want to develop an application that gets the configuration items from a json file and stores the key&values at ConfigurationManager.AppSettings. But AppSettings dictionary is readonly. We don't want to update or save the app.config file. This operation have to be at memory. Is there any way to do this?


回答1:


The answer was so easy. I found in the deep of other topics.

answer

ConfigurationManager.AppSettings.Set(configItem.Key, configItem.Value.ToString());



来源:https://stackoverflow.com/questions/46191584/how-to-set-app-settings-without-save-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!