The magic here is to use ConfigurationSection classes.
These classes simply should contain properties corresponding to 1: 1, with your configuration scheme. You use attributes to let .NET know which properties correspond to those elements.
So you can create a PaymentMethod and inherit it from ConfigurationSection
And you must create a SubPaymentMethod and inherit it from ConfigurationElement.
PaymentMethod will have a ConfigurationElementCollection SubPaymentMethods in it as a property, that is, how you connect complex types together.
You do not need to write your own XML syntax code.
public class PaymentSection : ConfigurationSection { // Simple One [ConfigurationProperty("name")]] public String name { get { return this["name"]; } set { this["name"] = value; } } }
etc...
See here how to create a ConfigurationElementCollections so you can have nested types:
http://blogs.neudesic.com/blogs/jason_jung/archive/2006/08/08/208.aspx
source share