C# – Should I Have a Separate XML Settings File for My Application?

cconfigurationxml

I want to be able to add some objects to my application by simply adding a XML node to a config file. Should I put it in the app.config file or should I make a separate XML config file? A node would look something like this

<Books>
   <Book>
     <title></title>
     <author></author>
   </Book>
</Books>

In that case I would add multiple books to my application by adding them in the config file. Is it bad practice to have 2 config files? I tried googling for solutions about the app.config file but it seems to not be the place to do it.

Best Answer

Most likely, you want a separate file. App.config is for application configuration, whereas what you are specifying is data.

Your data store could eventually become a database or json, or whatever else. Keeping it separate will make moving to something else easier in the future.

Related Topic