Look up key value pair in Generic Dictionary
Posted on 2007-10-11
I"m trying to check weather a value exists in the Dictionary. The dictionary is defined for example with a string key and then the value is a string of comma delimited values like this
So I'm trying to check whether a single string value exists in the Dictionary for a specific key and in the value's list
Here I just populate the Dictionary with a Generic string for the value of the key value pair
private void setupDictionary()
List<string> list1 = null;
List<string> list2 = null;
Now I'm trying to check whether a another list value is in the dictionary. So lets say there is only one record in the generic list rightsRequested such as "Delete". I need to check whether this user has delete permissions by seeing if the dictionary contains that key (the user's name) and if "Delete" is in the lkist of value for that user.
bool result = dicRights.Contains(principal.Identity.Name, rightsRequested);
So the error I get on the line above is with the rightsRequested. Doesn't look Iike I can use the method Contains on the dictionary to do what I want...so what method could I use or am I going about this lookup wrong in terms of looking up key values like this in a Dictionary as I have set this up?
Error: No overload for method 'Contains' takes '2' arguments