Skip to content

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

public int RemoveMany(Func<KeyValuePair<TKey, TValue>, bool> predicate)

View source (opens in a new tab)

Summary: Removes all entries that match the specified predicate from the dictionary.

Parameters

NameTypeDescription
predicateFunc, bool> (opens in a new tab)A function that returns true for entries that should be removed.

Returns: int (opens in a new tab) -- The number of entries removed from the dictionary.

Remarks

The predicate runs on a point-in-time copy of each shard outside the locks, so it may read the dictionary. An entry whose value changed after the copy was taken is kept.

Exceptions

TypeCondition
System.ArgumentNullException (opens in a new tab)predicate is null.