Dictionary with values in array

The situation is, I would like to load a relatively static table in memory to use everywhere in the app. For instance:

GUID Name Score
101 Peter 98
202 Sam 70
212 Shirley 100

I can use in-Memory SQLite to store, but what if I want to use a Dictionary? What is the difference between the 2?

Seems that this doesn’t work:

a(0) = rs.Name
a(1) = rs.Score
myDictionary.Value(rs.GUID) = a

create a CLASS with properties of NAME and SCORE
and create a DICTIONARY where “a” is a reference to an instance of the class

// assuming class "myRecord" has been defined already
myDictionary.value(guid)=new myRecord(name,score)

If you are just going to a simple “storage vessel” with keyed access (ie. by GUID) and the number of values is fairly small than a dictionary might be fine, if it is larger, then the power of a database and ability to use SQL to manipulate it is better.

Also if you want to do statistical functions such as find max score, averages, etc… a database and sql would be easier.

[quote=259960:@Tony Lam]a(0) = rs.Name
a(1) = rs.Score
myDictionary.Value(rs.GUID) = a[/quote]
Of course this will work, if done correctly. There is no rs.Name … should rs be a RecordSet –, you need to use rs.Field(“Name”)…

searching a dictionary for complex criteria means YOU write ALL the code - to set up the criteria & to do the search
an in memory db you just write the criteria (sql)

tested code
sqlite is very well used & well tested
your code less so

sqlite in memory is VERY fast
searching a dictionary will likely be slower