I have a standalone application that will remain relatively small. I'm trying to evaluate between using XML files or a lightweight database for local storage of data that needs to be persisted. What factors should I consider when choosing between the two approaches?

Let's assume that I have a program that will have the following functionality and requirements:

  1. A user will be given a drop-down list of all of the available items in the program, each representing a different type of an object (i.e., different cars, technical components, animals, etc.) which will be populated when the program loads from the available selection, thus it is dynamic in that it reflects the available data with nothing hard-coded. If someone adds/removes the files/entries for an object, it will no longer be accessible in the program and will vanish from the drop-down list when it is reloaded.
  2. It will be possible for a user to add a new object (with an interface of textboxes and other such modifiable elements) to the collection of data and make use of it. Data must also be easily shared by adding the new objects to another individual's collection afterwards:
    • One thought would be simply dragging+dropping files into a folder or handling the file moving on the interface
    • Another would be having the interface allow the option to merge entries in a shared database file to the user's file

I was considering the C# local database files for this, which I have not been able to get a strong understanding of in my research. I am assuming what I am thinking about them is true but I am not confident in this. This is not a client-server application in any way and will run locally on (hypothetically) any modern Windows installation.

The program is, in short, a creature generator for an RPG, meant to give the user an easier time doing the calculations and designs for whatever they want to do by taking most of it out of their hands. Ideally this will be a quick "install this, and you're done" sort of application, with little to nothing else that needs to be done or installed besides. There are approximately 80 fields for each object, and about 150 lines of XML (I have a template file but no work done on the parser), but many are simple strings or key-value pairs that will not change when the objects are loaded. The XML files or database rows could easily expand, as certain things such as the list of skills could expand drastically for some creatures (i.e. some creatures may have one column/field for a certain section, another may have 10). I am expecting there to be in the range of 300-600 possible choices, but as above, the number is dynamic and could increase beyond that. I do not expect it to go above 1000.

I am aware that pure text files may be another option, but the nature of my program could make them a bit messy to read/parse, perhaps, but they are not a complete impossibility if neither of these two are valid options.

Would the simplicity of using the XML, since they are single files and thus easier to share, outweigh the potential efficiency of the database option?

My assumptions on the matter lead me to believe the following:

  • If the local databases work the way I expect them to, and are as simple as I'm hoping, there will be no doubt in my mind that it will be the easier approach, except for the fact that it may be difficult to share only ONE object's data. There are other portions of the code which may also benefit greatly from the use of these tables as well; if they are what I think they are, things will become much easier for myself and most likely the user.
  • From previous experience parsing XML with C#, it should be rather simple, but maybe not as reliable or efficient, to perform the specified operations with XML files.


  • 1
    Can you tell us a little more about what the actual program does in real life? In other words, what problem does it solve? Commented Sep 26, 2014 at 4:09
  • Remember, XML is a data interchange format that has the side effect of being human-readable and editable (usually, there are exceptions such as DOCX). Given this will run on a single system, I would focus more on who or what needs to use the files than performance or any other concern.
    – user22815
    Commented Sep 26, 2014 at 4:19
  • recommended reading: What is the problem with “Pros and Cons”?
    – gnat
    Commented Sep 26, 2014 at 6:32
  • 1
    I have tried to clarify the actual purpose and scale of the program, and took away the "Pros and Cons" portion of the question, directing it into what I feel is my real toss-up between the two. If there is anything else that can be done to narrow it further, please let me know. Thanks, all four of you, for the feedback. I appreciate it.
    – Crabgor
    Commented Sep 26, 2014 at 10:35
  • 1
    Possibly of interest: What is a good choice of database for a small .NET application? SQLite is worth investigating Commented Sep 26, 2014 at 13:20


Your Answer

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

Browse other questions tagged or ask your own question.