Add polyfills for HashSet<T>.TryGetValue(...) and SortedSet<T>.TryGetValue(...)#50
Add polyfills for HashSet<T>.TryGetValue(...) and SortedSet<T>.TryGetValue(...)#50
HashSet<T>.TryGetValue(...) and SortedSet<T>.TryGetValue(...)#50Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds polyfill implementations of the TryGetValue method for HashSet<T> and SortedSet<T> collections, targeting older framework versions (NETCOREAPP < 2.0, NETFRAMEWORK < 4.7.2, NETSTANDARD < 2.1). The implementations iterate through the sets to find values using their respective comparers, along with test coverage for both.
- Added
TryGetValueextension methods forHashSet<T>andSortedSet<T> - Included test suites for both implementations
- Used the extension syntax pattern consistent with the existing codebase
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| PolyShim/NetCore20/SortedSet.cs | Adds TryGetValue polyfill for SortedSet<T> with proper nullability annotations using [MaybeNullWhen(false)] |
| PolyShim/NetCore20/HashSet.cs | Adds TryGetValue polyfill for HashSet<T>, but uses inconsistent nullability annotation and missing required import |
| PolyShim.Tests/NetCore20/SortedSetTests.cs | Comprehensive test coverage with 9 test cases covering various scenarios including custom comparers, value types, and edge cases |
| PolyShim.Tests/NetCore20/HashSetTests.cs | Basic test coverage with only 3 test cases, missing several scenarios covered in SortedSetTests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HashSet<T>.TryGetValue(...)HashSet<T>.TryGetValue(...) and SortedSet<T>.TryGetValue(...)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
No description provided.