ConfigurationManager.AppSettings[“SettingName”] vs Properties.Settings.Default.SettingName when should I use each?

后端 未结 4 1725
悲&欢浪女
悲&欢浪女 2021-02-04 01:11

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 a

4条回答
  •  执笔经年
    2021-02-04 01:52

    The biggest difference is that the generated properties are readonly, so the main reason to use AppSettings is if you want to write them (which is rare).

    And yes, you could use AppSettings for dynamicaly generated settings but that is rare too.

提交回复
热议问题