views:

126

answers:

2

What would be the best way to store a tree like the one below in app.config and how would I deserialize this information from it?

Tree
|-node1-
|       |-name - value
|       |-name - value
|       | ......
|-node2-
|       |-name - value
|       |-name - value
|       | ......
|-node3-
|       |-name - value
|       |-name - value
|       | ......

I can convert that tree to xml if that helps.

Thanks for any assistance in advance.

+2  A: 

Use a custom configuration section. For one way to do this, see Configuration Section Designer. You can do it manually, but you might like to play with CSD and see the code it generates.

John Saunders
+1  A: 

You can extend .config with your own types. These can be elements containing other elements and attributes. This area does seem to be poorly documented but there are examples out there.

Start with the System.Configuration.ConfigurationElement class.

Richard