I would like to have a configuration section like the following:
<mycollection>
<add name="myelement" type="class, assembly" var1="value" var2="value" />
<add name="myelement2" type="class2, assembly" var1="value" var3="value" var4="value" />
</mycollection>
The idea being that the actual ConfigurationElement
created is defined by the type value, and that each element will have its own specific set of attributes.
Another option would be that all the elements are the same, but they load the values from a different configuration section, e.g.:
<mycollection>
<add name="myelement" configuration="myothersection" />
<add name="myelement2" configuration="myothersection2" />
</mycollection>
<myothersection type="class, assembly" var1="value" var2="value" />
This seems easier to implement but leads to more verbose configuration file.
Is the first option respecting the .NET configuration pattern, and secondly, is that possible?