I’ve got a whole host of values stored in a .net 2.0 hashtable. What I would really like to find is a way to, essentially, do a SQL select statement on the table.
Meaning, I’d like to get a list of keys whose associated values match a very simple text pattern (along the lines of ‘starts with a number’.)
The final goal will be to remove these records from the hashtable for further processing.
I’ve been beating my head against this for a while now, and I can’t seem to come up with anything.
Any ideas?
(On the off chance this matters: due to the realities of this project, any 3rd party widgets or upgrading to a more recent version of .net are off the table.)
You could use a regex against every key in the hashtable. This is very dirty but it works:
EDIT: And just for fun, here is the LINQ version (sorry I just had too).
EDIT: I have just added list of sting rather then a hashtable, I couldn’t remember which .net version had generic lists in it ***slaps forehead