Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone explain, in plain English, the difference between ConfigurationSection and ConfigurationElement?

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?

like image 894
Jason 'Bug' Fenter Avatar asked Sep 28 '10 20:09

Jason 'Bug' Fenter


1 Answers

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.

like image 117
Yogesh Avatar answered Oct 06 '22 00:10

Yogesh