I have a Dictionary<string, string>
.
I need to look within that dictionary to see if a value exists based on input from somewhere else and if it exists remove it.
ContainsValue just says true/false and not the index or key of that item.
Help!
Thanks
EDIT: Just found this - what do you think?
var key = (from k in dic where string.Compare(k.Value, "two", true) ==
0 select k.Key).FirstOrDefault();
EDIT 2: I also just knocked this up which might work
foreach (KeyValuePair<string, string> kvp in myDic)
{
if (myList.Any(x => x.Id == kvp.Value))
myDic.Remove(kvp.Key);
}