App.Config与自定义XML文件 [英] App.Config vs Custom XML file

查看:200
本文介绍了App.Config与自定义XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多声明,例如"您不应该使用自定义设置来阻塞app.config文件".但是,我觉得这正是文件的目的?

I have read a lot of statements like "you shouldn't clog your app.config file with custom settings". However, I was under the impression that this was exactly the purpose of the file?

这确实是一种偏爱吗?还是使用与app.config文件相对应的自定义XML文件,除了设置分离之外,还有什么真正的好处?如果您需要明确区分设置,那么使用自定义ConfigurationSection而不是选择自定义XML文件会更好吗?

Is it just indeed a preference thing? Or are there any real benefits (other than separation of settings) by using a custom XML file, as apposed to the app.config file? If you need to explicitly separate settings would it better to use a custom ConfigurationSection rather than opting for a custom XML file?

我想在这里让其他人对此发表看法.

I would like to here other peoples thoughts on this.

推荐答案

根据我的拙见,有些人倾向于在自定义配置节处理程序上过分强调.

Some people tend to go a bit overboard on custom config section handlers, in my humble opinion.

我倾向于仅在我需要非常结构化的东西时才使用它们.并由第三方使用/编写(即我想对其进行一些Extravagent验证).

I tend to use them only when I need something that is very structed; and that is used/written by 3rd parties (i.e. I want to do some extravagent validation on it).

我认为您可以很高兴地将app.config/web.config用于所有相关设置,并在很明显是应用程序的独立组件时使用独立的XML文件.

I think you can quite happily use app.config/web.config for all relevant settings, and use separate XML files when it is very clear that is a separate component of the app.

这篇关于App.Config与自定义XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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