即使在c#中关闭应用程序后,如何在App.config文件中存储值 [英] How to store values in App.config file even after closing application in c#

查看:77
本文介绍了即使在c#中关闭应用程序后,如何在App.config文件中存储值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI

可以告诉我如何在app.config文件中存储键值对并保存它们,以便即使关闭应用程序后值也不会消失。



谢谢

解决方案

如果您使用App.Config将值存储在< app key =value =中>或者CustomSections部分使用ConfigurationManager类,否则使用XMLDocument类。



如需代码,请参阅以下链接:

阅读/编写带有.NET 2.0的App.Config文件 [ ^ ]


你可以从这个链接获得更多的想法。



http://stackoverflow.com/questions/4758598/write-values-in-app-config-file [ ^ ]



用于反映与您的问题类似的变化。

http://stackoverflow.com/questions/1913903/changes-in-app-config-do-not-reflect-after-restarting-the-application [ ^ ]

HI
Can any tell me how to store key value pairs in app.config file and save them so that the values will not disappear even after closing the application.

Thank you

解决方案

If you are using App.Config to store values in <app key="" value=""> or CustomSections section use ConfigurationManager class, else use XMLDocument class.

For code refer below link:
Read/Write App.Config File with .NET 2.0[^]


You can have more Idea from this link.

http://stackoverflow.com/questions/4758598/write-values-in-app-config-file[^]

For reflect changes which looks similar to your problem.
http://stackoverflow.com/questions/1913903/changes-in-app-config-do-not-reflect-after-restarting-the-application[^]


这篇关于即使在c#中关闭应用程序后,如何在App.config文件中存储值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆