ConfigurationManager.AppSettings [“SettingName”] vs Properties.Settings.Default.SettingName什么时候应该使用每个? [英] ConfigurationManager.AppSettings["SettingName"] vs Properties.Settings.Default.SettingName when should I use each?

查看:335
本文介绍了ConfigurationManager.AppSettings [“SettingName”] vs Properties.Settings.Default.SettingName什么时候应该使用每个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该指定什么时候应该使用configurationManager.AppSettings或visual studio生成的强类型设置?强类型似乎在大多数情况下更合适,但我认为可以使用ConfigurationManager方法动态添加设置到已部署的应用程序,但有什么指导方针,每种情况下每个设计使用?

What should dictate when I should use the configurationManager.AppSettings or the strongly typed settings that visual studio generates? The strongly typed ones seem much more appropriate in most cases, but I suppose that it would be possible to add settings dynamically to a deployed application using the ConfigurationManager approach, but are there any guidelines under which circumstances each is designed to be used?

推荐答案

阅读,看起来像AppSettings是做旧事的方式。 MSDN文档
声明如果您正在使用设置,则可以在运行时写入用户设置。

From what I read, looks like AppSettings is the older way of doing things. MSDN docs states that user settings can be written at run time if you are using settings.

我总是喜欢强类型设置,可以使用ConfigSection处理程序实现。

I always prefer strongly typed settings, which can be implemented with ConfigSection handlers.

appSettings vs applicationSettings(.NET app.config)的优点和缺点

这篇关于ConfigurationManager.AppSettings [“SettingName”] vs Properties.Settings.Default.SettingName什么时候应该使用每个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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