-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add polyfill for string.GetHashCode(StringComparison)
#53
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a polyfill for the string.GetHashCode(StringComparison) method that was introduced in .NET Core 2.0. The implementation delegates to the appropriate StringComparer based on the provided StringComparison enum value, enabling backward compatibility for older framework versions.
Key changes:
- Implemented
GetHashCode(StringComparison)extension method using a switch expression to delegate to correspondingStringComparerinstances - Added basic unit tests to verify hash code equality for identical strings and case-insensitive comparisons
- Updated documentation to reflect the new member count (171 members, 233 total signatures)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PolyShim/Signatures.md | Updated member and total signature counts to reflect the addition of one new string method |
| PolyShim/NetCore20/String.cs | Implemented the GetHashCode(StringComparison) polyfill using switch expression with conditional compilation for InvariantCulture cases |
| PolyShim.Tests/NetCore20/StringTests.cs | Added basic test coverage for Ordinal and OrdinalIgnoreCase comparisons |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #53 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.