I’m coding an application in C#, and I need like, a database of built in data that’s linked with the application. I wont ever need to edit the data, I just need easy access to it.
Basically I want it so I have data built into the application that’s represented like this:
Book Title Book Author SomeBookTitle SomeBookAuthor SomeOtherBookTitle SomeOtherBookAuthor
Kinda like that? Easy accessible, and preferably linked with the application somehow, so I only have 1 executable file. Oh and there might be a lot of data…
I suggest a different approach than the others so far.
I wouldn’t use a resource file because presumably you don’t want to hard code every reference to every line in the resource file. 100 “books” would mean 100 distinct resources to code against.
And if you want self contained deployment, 3rd party components are problematic.
My suggestion: Put all your data in an XML structure and put that XML in a resource file as one single resource.
Put that in your resource file as MyData
Then you can iterate it with:
Or you can use LinqToXml or any number of alternatives.