Using .NET 3.5, is there a way to retrieve a value from Hashtable corresponding to the key without iteration?
views:
54answers:
1And depending which hash class you're using (System.Collections.Generic.Dictionary) you can use TryGetValue() to avoid an exception if the key doesn't exist.
Dewayne Christensen
2009-12-02 14:42:50
Thats correct, don't forget to either use a .TryGetValue() or use .Contains() before attempting to retrieve the value.
Codebrain
2009-12-02 14:44:33