Skip to content

RemoveAll #78190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

RemoveAll #78190

wants to merge 6 commits into from

Conversation

tmat
Copy link
Member

@tmat tmat commented Apr 17, 2025

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 17, 2025
return;
}
#if NET
// .NET implementation of Dictionary<,> supports removing while enumerating:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// .NET implementation of Dictionary<,> supports removing while enumerating:
// .NET implementation of Dictionary<,> guarantees proper semantics of removing while enumerating.

/// </summary>
public static void RemoveAll<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, Func<TKey, TValue, bool> predicate)
where TKey : notnull
=> RemoveAll(dictionary, static (key, value, predicate) => predicate(key, value), predicate);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i always love this pattern of passing the predicate along as the arg into another predicate :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants