check if value is in dictionary c# code example
Example 1: c sharp check if key in dictionary
// To check if a dictionary has a certain key, use 'ContainsKey()'
dict.ContainsKey(key);
Example 2: if in dictionary c#
if (dict.ContainsKey(key)) { ... }
//or
dict.TryGetValue(key, out value);