Use `TryGetValue` instead of `Contains` followed by a lookup.