c# - 有人可以用简单的英语解释 ConfigurationSection 和 ConfigurationElement 之间的区别吗?

标签 c# .net configuration app-config

我正在阅读一篇关于 .NET 配置命名空间的精彩文章(找到 here),其中讨论了创建自定义部分、元素、集合、小部件和飞行 toastr 。我唯一的提示是这篇文章只是技术性的,没有提供任何概念背景。 MSDN 似乎也没有太多概念性信息。

那么有人可以解释一下什么是“部分”,什么是“元素”,以及什么时候适合使用它们?

最佳答案

我认为本系列文章更适合您阅读,它精彩地告诉您 C# 中配置的所有细节:

Unraveling the Mysteries of .NET 2.0 Configuration

Decoding the Mysteries of .NET 2.0 Configuration

Cracking the Mysteries of .NET 2.0 Configuration

并用简单的语言回答您的问题,ConfigurationSection是一个包含多个 ConfigurationElement 的容器和/或 ConfigurationElementCollection . ConfigurationSection 的父级永远是<configuration>这是配置文件中的根元素。

ConfigurationElement是容器和/或单个元素,始终是 ConfigurationSection 的一部分.

关于c# - 有人可以用简单的英语解释 ConfigurationSection 和 ConfigurationElement 之间的区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3816965/

相关文章:

windows - 如何从 Windows XP 的上下文菜单中更改 "Edit"和 "Print"操作的默认应用程序?

c# - Access数据库在c#中选择多行

c# - Linq-to-SQL 结合两个 Expression<Func<T, bool>> ("where clause") 与 and/or

php - 登录 phpMyAdmin 时出现错误 2002

c# - .Net 3.5 VS 2008 无效 token 'out' 错误

c# - TDD - 我做得对吗?

php - 从哪里获得适用于 php 7.0 的 64 位 php_zip.dll 扩展?

c# - System.Data.DataRowView,C#

c# - 用于 powercfg 电池报告的 GUI

.net - 在 System.Numerics.Vector<T> 中使用 F# 度量单位