Answer: With the help of ContainsValue method,we can check whether dictionary has a value or not?
Dictionary<string, string> dict_names = new Dictionary<string, string>();
dict_names.Add("name", "rajesh");
If(dict_names.ContainsValue["rajesh"])
return true;
else
return false;
It will return true because rajesh is present inside dictionary.
Asked In: Many Interviews |
Alert Moderator