This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Expose HashSet<T> ctors with capacity in netcoreapp1.1#12600
Merged
jkotas merged 3 commits intodotnet:masterfrom Oct 13, 2016
Merged
Expose HashSet<T> ctors with capacity in netcoreapp1.1#12600jkotas merged 3 commits intodotnet:masterfrom
jkotas merged 3 commits intodotnet:masterfrom
Conversation
Adds ctors to HashSet that accept a capacity. New tests are not included due to System.Collections.dll being a partial facade, and the repo not currently having the infrastructure to enable adding tests for new surface area in partial facades.
Contributor
Author
|
Part of #2869 |
stephentoub
reviewed
Oct 13, 2016
| Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new HashSet<T>(-1, comparer)); | ||
| Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new HashSet<T>(int.MinValue, comparer)); | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Can you add a test that adds to the HashSet up to and beyond the specified capacity?
Contributor
Author
There was a problem hiding this comment.
Sure, I'll add one soon.
stephentoub
approved these changes
Oct 13, 2016
Member
stephentoub
left a comment
There was a problem hiding this comment.
Thanks for porting it over.
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
Expose HashSet<T> ctors with capacity in netcoreapp1.1 Commit migrated from dotnet/corefx@edc03bd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port #2862 from Future to Master.
I cherry-picked the two relevant commits from the future branch:
I then added a third commit that cleaned some things up, exposed the APIs in netcoreapp1.1, and added tests.
cc: @stephentoub, @MarkusSintonen