Storing values in the web.config - appSettings or configSection - which is more efficient?

后端 未结 3 1705
悲&欢浪女
悲&欢浪女 2021-02-05 21:55

I\'m writing a page that can use a couple of different themes, and I\'m going to store some information about each theme in the web.config.

Is it more efficient to cre

3条回答
  •  面向向阳花
    2021-02-05 22:55

    There'll be no difference in performance, since ConfigurationManager.AppSettings just calls GetSection("appSettings") anyway. If you'll need to enumerate all the keys, then a custom section will be nicer than enumerating all of appSettings and looking for some prefix on the keys, but otherwise it's easier to stick to appSettings unless you need something more complex than a NameValueCollection.

提交回复
热议问题