I’m a newbie c# programmer.
I searched for a lot of tutorial related to app.config, but I couldn’t find what I’m looking for. I planned to use it as a replacement for database, because my data is just little.
How do you create a config file with more than one category. is it legal to do this?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<Codes>
<Code value="00">Success</Code>
<Code value="01">Try Again</Code>
<Code value="02">Invalid Format</Code>
...
</Codes>
<Fields>
<Field type="1">0034</Field>
<Field type="2">Food</Field>
...
</Fields>
</configuration>
And if this is possible. Will there be changes on how to parse it?
Yep, it’s possible and easy. You can write your own custom config section handler (ConfigurationSection).
Take a look at this articles:
How to: Create Custom Configuration Sections Using ConfigurationSection
Understanding Section Handlers – App.config File
Creating a Custom Configuration Section in C#
Custom Configuration Section in C#