[Proposal] RemoveRange method for Dictionary #9587
Replies: 2 comments
-
Requests for API changes should be made on the runtime repository. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A Remove method already exists for dictionaries, but I was surprised to not find a method that removes a list of keys from a dictionary.
I had to do something like:
dic = dic.Where(kvp => !dic2.Contains(kvp.Key)).ToDictionary(kvp => kvp.Key, kvp.Value);
Sure, it's possible to implement as an extension method, but it would be nice to have it integrated by default.
Beta Was this translation helpful? Give feedback.
All reactions