Skip to content

Conversation

@canyon-online
Copy link
Contributor

@canyon-online canyon-online commented Nov 20, 2025

Summary

Add paragraph demonstrating an example of a constrained generic for an extension block

Fixes #50068


Internal previews

📄 File 🔗 Preview link
docs/csharp/programming-guide/classes-and-structs/extension-methods.md Extension members (C# Programming Guide)

Copilot AI review requested due to automatic review settings November 20, 2025 17:52
@canyon-online canyon-online requested review from a team and BillWagner as code owners November 20, 2025 17:52
@dotnetrepoman dotnetrepoman bot added this to the November 2025 milestone Nov 20, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-csharp/svc fundamentals/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Nov 20, 2025
@canyon-online
Copy link
Contributor Author

@dotnet-policy-service agree

Copilot finished reviewing on behalf of canyon-online November 20, 2025 17:53
Copy link
Contributor

Copilot AI left a 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.date field 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

Copy link
Member

@BillWagner BillWagner left a 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.

@BillWagner BillWagner enabled auto-merge (squash) November 21, 2025 15:43
@BillWagner BillWagner merged commit 8411a1c into dotnet:main Nov 21, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc fundamentals/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generic extension block example to programming guide

3 participants