ConfigurationManager.AppSettings [" SettingName"] VS Properties.Settings.Default.SettingName时,我应该使用的呢? [英] ConfigurationManager.AppSettings["SettingName"] vs Properties.Settings.Default.SettingName when should I use each?

查看:135
本文介绍了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?

推荐答案

从我read,貌似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.

我总是preFER强类型设置,它可以与ConfigSection处理程序来实现。

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

<一个href="http://stackoverflow.com/questions/460935/pros-and-cons-of-appsettings-vs-applicationsettings-net-app-config">http://stackoverflow.com/questions/460935/pros-and-cons-of-appsettings-vs-applicationsettings-net-app-config

这篇关于ConfigurationManager.AppSettings [&QUOT; SettingName&QUOT;] VS Properties.Settings.Default.SettingName时,我应该使用的呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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