Should I use XML to store configuration settings in my C # .Net application?

My question is about the performance implications of reading application configuration data from an XML file.

I am creating an application that displays information from a database and needs to know how to display lists, depending on the types of data returned.

This is hard to explain, but basically I would like to have an XML configuration file that lists the types and describes how to display them. This will allow me to change the display methods without recompiling the application.

My question is really about performance. Given that my application will have to reuse this data during the loading of each page ...

  • Do I have to read directly from the XML file and parse it every time I need it?
  • Or should I cache the XML object and parse it every time I need it?
  • Or do you need to parse the XML once, create some kind of object and cache this object?

My guess is option 3, but I'm mainly looking for best practices around this.

Thanks.

+4
source share
1 answer

An agreement already exists for this, called the App.config .

This is XML, and Visual Studio has toolkit support.

My suggestion: do not reinvent the wheel if you can help him.


Now, considering that your format is too complicated for this, you probably want to go with option 3, but load it lazily.

+4
source

Source: https://habr.com/ru/post/1343322/


All Articles