-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add polyfills for Enum.IsDefined<T>(...) and Enum.HasFlag(...)
#57
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 polyfills for two Enum methods that were introduced in later framework versions: Enum.IsDefined<T>(...) (added in .NET 5.0) and Enum.HasFlag(...) (added in .NET Framework 4.0). The polyfills enable these APIs to be used in older framework versions.
Key changes:
- Adds
HasFlaginstance method polyfill for pre-.NET 4.0 Framework versions - Adds
IsDefined<T>static method polyfill for pre-.NET 5.0 versions - Updates documentation to reflect the addition of 2 new members (246 total, 184 members)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PolyShim/Signatures.md | Updates totals and adds documentation entries for HasFlag and IsDefined<T> |
| PolyShim/NetCore10/Enum.cs | Implements HasFlag instance method for enum flag checking |
| PolyShim/Net50/Enum.cs | Implements IsDefined<T> generic method as a wrapper around non-generic version |
| PolyShim.Tests/Net50/EnumTests.cs | Adds unit test for IsDefined<T> with valid and invalid enum values |
💡 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 #57 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.