If it were me, I'd just drag the text file directly into the project. Then at app startup (or better yet, the first time you need to look up a word), split the file on its end-of-line delimiter and stuff the words into a Dictionary object (as keys, with a dummy value like True).

Stuffing the dictionary with 3.9 MB of data might take a second or so, but then lookup (using Dictionary.HasKey) will be blazingly fast. Also, since you know ahead of time how many words you'll be stuffing, you can make the stuffing go faster by pre-sizing the dictionary (i.e., assign a suitably large BinCount before you start loading in values).

Okay, I've got the dictionary loaded, but HasKey is always returning false. Any Ideas?

BinCount of the dictionary is 65521, Count is 177741, loading it takes 2 seconds on a dual 1 GHz G4, and HasKey returns an answer virtually instantaneously.


Andrew Keller
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to