c# check if item exists in dictionary code example
Example 1: c# check to see if dictionary key exists
bool keyExists = dict.ContainsKey(key);
Example 2: if in dictionary c#
if (dict.ContainsKey(key)) { ... }
//or
dict.TryGetValue(key, out value);