I am writing an application that takes user data and saves it locally for later use. The application will be started and stopped quite often, and I would like it to save / load data at the beginning and end of the application.
It would be quite simple if I used flat files, since the data really does not need to be protected (it will be stored only on this PC). Possible options:
Flat files require a bit more support (there are no built-in classes such as XML), however I have not used XML before, and SQL seems redundant for this relatively simple task.
Are there any other features worth exploring? If not, which one is the best solution?
Edit: To add a little more data to the problem, basically the only thing I would like to save is a dictionary that looks like this:
Dictionary<string, List<Account>>
where Account is another user type.
Would I serialize the dict as xmlroot and then the account type as attributes?
Update 2:
Thus, you can serialize the dictionary. The difficulty is that the value for this dict is the generalization itself, which is a list of complex data structures of type Account. Each account is pretty simple, it's just a bunch of properties.
I understand that the goal here is to try to summarize:
<Username1> <Account1> <Data1>data1</Data1> <Data2>data2</Data2> </Account1> </Username1> <Username2> <Account1> <Data1>data1</Data1> <Data2>data2</Data2> </Account1> <Account2> <Data1>data1</Data1> <Data2>data2</Data2> </Account2> </Username2>
As you see heirachy
- Username (dict string)>
- Account (each account in the list)>
- Account data (i.e. class properties).
Getting this layout from Dictionary<Username, List<Account>> is the hard bit and the gist of this question.
There are many βhowβ answers in serialization, this is my mistake, since I did not make it clearer at an early stage, but now I am looking for a specific solution.