Hi,
I need to read and write Configuration Settings as shown below:
<MySettings>
<General>
<Color>Red</Color>
<.Font>TimesNewRoman</Font>
<Path>C</Path>
</General>
<Employee Type="Manager"> //More than one employee
<Function Type="Stationary"> //More than one function
<Department name="Department1">
<Line Color="Blue" Font="" HideWhenShrinked="true/false">
<LineEntry Color="Green" Font="Arial">
<Tag> Tag1 </Tag>
<.Pre> Pre1</Pre>
<Post> Post1</Post>
</LineEntry>
<LineEntry Font="Arial">
<Tag> Tag2</Tag>
<.Pre> Pre2</Pre>
<Post>Post2</Post>
</LineEntry>
</Line>
</Department>
</Funtion>
<Function Type="Projects">
<Department name="Department2">
<Line HideWhenShrinked="true/false">
<LineEntry Color="Green" Font="Arial">
<Tag> Tag1 </Tag>
<.Pre> Pre1</Pre>
<Post> Post1</Post>
</LineEntry>
<LineEntry Color="Yellow" Font="Arial">
<Tag> Tag2</Tag>
<.Pre> Pre2</Pre>
<Post>Post2</Post>
</LineEntry>
<LineEntry Color="Yellow" Font="Arial">
<Tag> Tag3</Tag>
<.Pre> Pre3</Pre>
<Post>Post3</Post>
</LineEntry>
</Line>
</Department>
</Function>
</Employee>
</MySettings>
There are two aspects here:
(1) The settings are hierarchical.
(2) When a setting is not specified for any element (eg. Color) I need
to use the setting from the parent element and so on.. If an element
has no parent element I need to get the setting from the General
section.
How can I do this? Can I do this using the new ConfigurationSection in
..Net 2.0 or do I need to use XML and parse the settings file on my own?
Thanks for your help,
Satya.