5

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.

0

2 Answers 2

9

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.

0

Keeping a separate xml file is advisable because in future you may need to change these settings written in it and if it is in config then might be complex to change it...

But make sure while going live that make that file read only for security reasons..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.