DictionaryExtensions.Where<TKey, TValue>
Extension Method in DictionaryExtensions
Declaration
public static Dictionary<TKey, TValue> Where<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, Predicate<KeyValuePair<TKey, TValue>> predicate)
Description
Filters the dictionary by a predicate.
Type Parameters
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |
Parameters
dictionary | The dictionary to filter. |
predicate | The predicate to use. |
Returns
DictionaryT | A new dictionary with the filtered key-value pairs removed. |
Overload
Declaration
public static List<TKey> Where<TKey, TValue>(this Dictionary<TKey, TValue>.KeyCollection keys, Predicate<TKey> predicate)
Description
Filters the dictionary keys by a predicate.
Type Parameters
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |
Parameters
keys | The keys to filter. |
predicate | The predicate to use. |
Returns
ListT | A new list with the filtered keys removed. |
Overload
Declaration
public static List<TValue> Where<TKey, TValue>(this Dictionary<TKey, TValue>.ValueCollection values, Predicate<TValue> predicate)
Description
Filters the dictionary values by a predicate.
Type Parameters
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |
Parameters
values | The values to filter. |
predicate | The predicate to use. |
Returns
ListT | A new list with the filtered values removed. |