I was wondering if .NET offers any standard functionality for doing a prefix search through a list or a dictionary object. I came across the StringDictionary, but couldn't figure out if it can do that for me.
And if it can do a prefix search, can it also do substring search or let me search using something like a regular expression?
Thanks in advance.
StringDictionary is merely a hash table where the keys and values are strings. This existed before generics (when Dictionary<string, string> was not possible).
The data structure that you want here is a trie. There are implementations on CodeProject:
Or, if you're that kind of guy, roll your own (see CLRS).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With