views:

33

answers:

1

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?

+1  A: 

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, ConfigurationSection is a container which contains multiple ConfigurationElement and/or ConfigurationElementCollection. The parent of ConfigurationSection will always be <configuration> which is the root element in configuration files.

ConfigurationElement is a container and/or single element and is always part of a ConfigurationSection.

Yogesh
:) The link I provided was the first of the three articles that you referenced.
Jason 'Bug' Fenter
Oops... "Enter" key sends. I meant to add that "ConfigurationSection" still confuses me. There is a ConfigurationSectionGroup class and ConfigurationSectionCollection class. Also, since a ConfigurationElement can be a container of multiple elements, I still don't understand why there's a different ConfigurationSection class. They seem to be fundamentally the same.
Jason 'Bug' Fenter