我试图在运行时更改我的应用程序设置文件的一个键,但它不起作用。
我就是这样做的:
ConfigurationSettings.AppSettings["XPTO"] = "HELLO";
貌似只在内存里变,文件上没变。
有人知道怎么做吗?
谢谢。
最佳答案
看看我的overview of .NET settings files ...简而言之,我认为您需要一个用户范围的设置。它的行为将更符合您的预期。
Edit: If you are using the settings designer in Visual Studio, then simply change the "Scope" to "User". If not, you should be able to do the equivalent programmatically.
关于c# - 如何更改运行时应用程序设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/546229/