I’m reading through a fantastic article on the .NET Configuration namespace (found here) which talks about creating custom sections, elements, collections, widgets, and flying toasters. The only complaint I have is that the article is only technical and doesn’t provide any conceptual context. MSDN doesn’t appear to have much conceptual information, either.
So can someone explain, please, what a “section” is, what an “element” is, and when it would be appropriate to use each?
I think a better read for you will be this series of articles, which brilliantly tells you about all the details of configurations in 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
And to answer your question in simple words,
ConfigurationSectionis a container which contains multipleConfigurationElementand/orConfigurationElementCollection. The parent ofConfigurationSectionwill always be<configuration>which is the root element in configuration files.ConfigurationElementis a container and/or single element and is always part of aConfigurationSection.