I’m looking for a multi-column database, but even SQLite at over a megabyte seems like overkill (and it isn’t available for C# unless you use something like this). I only want 100-500k max of code. What’s the best option here?
The Generic Dictionary in C# is useful to an extent, but by default, it won’t allow you to retrieve the key/s from a given value. Likewise, I might have more than two columns of data, and even if I used a BiDictionary with the value as a class/struct (for multiple values), I would need to find the key of an n-column value, then find the new o-column value of the key. So that’s a bit inconvenient (plus that link is an incomplete implementation without even a ‘set’ command).
Here’s a simple example of a table I might create (I might have a dozen columns or a thousand rows however):
name type colour length
orange a orange 5
apple a green 4
banana c yellow 7
strawberry b red 3
blackberry b black 2
gooseberry b green 2
I’d like to retrieve/set any value/s in the table from any other value/s preferably using LINQ or an SQL-like query along with fast retrieval/writing and large-ish datasets if possible.
The
DataSetclass may be a good fit for what you are doing – you can load data into it directly from XML (ReadXmlmethods), which would translate into in memory tables.Using the
DataTable(or several and their relationships) representing your data you can query it using LINQ.