-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add example demonstrating generic extension blocks #50069
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
|
@dotnet-policy-service agree |
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 documentation and a code example demonstrating how to use generic type parameters with constraints in C# 14 extension blocks, addressing issue #50068.
Key changes:
- Added a new code snippet showing a generic extension block with
IEquatable<T>constraint - Updated documentation to explain that extension blocks support generic type parameters with or without constraints
- Updated the
ms.datefield to reflect the documentation change
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| CustomExtensionMembers.cs | Adds GenericExtensionBlock code snippet demonstrating a generic extension with IEquatable<T> constraint |
| extension-methods.md | Adds explanatory paragraph and references the new generic extension block example; updates documentation date |
docs/csharp/programming-guide/classes-and-structs/extension-methods.md
Outdated
Show resolved
Hide resolved
BillWagner
left a comment
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.
Thanks @canyon-online
I do have a couple wording suggestions, then I'll merge.
Summary
Add paragraph demonstrating an example of a constrained generic for an extension block
Fixes #50068
Internal previews