your best bet is probably to expand the dictionary (which probably should have ContainsAny()or ContainsAnyKey()).
public static bool ContainsAny<K, V>(
this Dictionary<K, V> dict, IEnumerable<K> keys)
{
foreach(K key in keys)
if(dict.ContainsKey(key)) return true;
return false;
}
and it could be linq'd like:
public static bool ContainsAny<K, V>(
this Dictionary<K, V> dict, IEnumerable<K> keys)
{ return keys.Any(key => dict.ContainsKey(key)); }
source
share