Skip to content

Conversation

@BillWagner
Copy link
Member

@BillWagner BillWagner commented Nov 24, 2025

Contributes to #45758

Where samples use this extension methods, except where explaining the this syntax, convert to the C# 14 extension member syntax,

This PR doesn't include the tutorials, or LINQ sub-folders in the C# Guide. Those will be in a separate PR.


Internal previews

Toggle expand/collapse
📄 File 🔗 Preview link
docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md Tutorial: Mix functionality in when creating classes using interfaces with default interface methods
docs/csharp/how-to/index.md How to articles
docs/csharp/language-reference/attributes/caller-information.md Determine caller information using attributes interpreted by the C# compiler
docs/csharp/language-reference/builtin-types/built-in-types.md docs/csharp/language-reference/builtin-types/built-in-types
docs/csharp/language-reference/builtin-types/enum.md Enumeration types (C# reference)
docs/csharp/language-reference/compiler-messages/cs0122.md "Compiler Error CS0122"
docs/csharp/language-reference/keywords/method-parameters.md Method parameters and modifiers
docs/csharp/language-reference/keywords/this.md docs/csharp/language-reference/keywords/this
docs/csharp/language-reference/keywords/using-directive.md The using directive
docs/csharp/language-reference/keywords/where-generic-type-constraint.md "where (generic type constraint)"
docs/csharp/language-reference/operators/deconstruction.md Deconstruction expression - Extract properties of fields from a tuple or other user-defined type
docs/csharp/language-reference/operators/member-access-operators.md Member access operators and expressions - the dot, indexer, and invocation operators.
docs/csharp/language-reference/statements/iteration-statements.md docs/csharp/language-reference/statements/iteration-statements
docs/csharp/language-reference/statements/yield.md yield statement - provide the next element
docs/csharp/methods.md Overview of methods
docs/csharp/roslyn-sdk/get-started/syntax-transformation.md Get started with syntax transformation
docs/csharp/roslyn-sdk/tutorials/how-to-write-csharp-analyzer-code-fix.md Tutorial: Write your first analyzer and code fix

Where samples use `this` extension methods, except where explaining the `this` syntax, convert to the C# 14 extension member syntax,
This adds all the folders *except* tutorials and LINQ. (Those will be in separate PRs)
@BillWagner BillWagner marked this pull request as ready for review November 24, 2025 21:41
@BillWagner BillWagner requested a review from a team as a code owner November 24, 2025 21:41
Copilot finished reviewing on behalf of BillWagner November 24, 2025 21:45
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 updates C# documentation to replace references to "extension method" with "extension member" terminology, reflecting the C# 14 syntax changes that introduce extension blocks supporting properties, operators, and static extensions in addition to traditional extension methods.

Key changes include:

  • Terminology update from "extension method(s)" to "extension member(s)" across 18 documentation files
  • Code sample migration in CallerInformation.cs to demonstrate C# 14 extension member syntax
  • Target framework updates from net8.0/net9.0 to net10.0 in project files
  • Grammar improvements including contraction usage per style guidelines
  • Removal of unused code examples in GenericWhereConstraints.cs

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
docs/csharp/roslyn-sdk/work-with-syntax.md Updated terminology from "extension methods" to "extension members"
docs/csharp/roslyn-sdk/tutorials/how-to-write-csharp-analyzer-code-fix.md Updated terminology for GetDeclaredSymbol extension member reference
docs/csharp/roslyn-sdk/get-started/syntax-transformation.md Updated ReplaceNode reference from extension method to extension member
docs/csharp/methods.md Changed heading and content to reference extension members; includes problematic "comprise" word choice
docs/csharp/language-reference/statements/yield.md Fixed "can not" to "can't" contraction; updated ms.date
docs/csharp/language-reference/statements/iteration-statements.md Updated foreach and await foreach extension member references; includes problematic "may/can" changes
docs/csharp/language-reference/operators/member-access-operators.md Updated dot operator description to reference extension members
docs/csharp/language-reference/operators/deconstruction.md Updated Deconstruct extension member references; contains date typo (2024 vs 2025)
docs/csharp/language-reference/keywords/where-generic-type-constraint.md Fixed "does not" to "doesn't" contraction
docs/csharp/language-reference/keywords/using-directive.md Updated using static directive extension member references; fixed "is not" to "isn't"
docs/csharp/language-reference/keywords/this.md Clarified distinction between this for current instance vs extension method usage
docs/csharp/language-reference/keywords/snippets/Program.cs Removed commented-out test code calls
docs/csharp/language-reference/keywords/snippets/GenericWhereConstraints.cs Removed unused example code and using statements
docs/csharp/language-reference/keywords/method-parameters.md Updated extension member parameter restriction documentation
docs/csharp/language-reference/compiler-messages/cs0122.md Updated access modifier error message for extension members
docs/csharp/language-reference/builtin-types/enum.md Updated extension member reference; fixed contractions; includes questionable content changes
docs/csharp/language-reference/builtin-types/built-in-types.md Updated implicit span conversion extension member reference
docs/csharp/language-reference/attributes/snippets/attributes.csproj Updated target framework from net9.0 to net10.0
docs/csharp/language-reference/attributes/snippets/CallerInformation.cs Critical: Attempted migration to C# 14 extension member syntax with syntax errors
docs/csharp/language-reference/attributes/caller-information.md Updated CallerArgumentExpression extension member reference
docs/csharp/how-to/index.md Updated how-to links to reference extension members; inconsistent singular/plural usage
docs/csharp/advanced-topics/interface-implementation/snippets/mixins-with-default-interface-methods/mixins-with-interfaces.csproj Updated target framework from net8.0 to net10.0
docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md Updated tutorial content to use extension member terminology; includes unnecessary grammatical changes

@BillWagner BillWagner requested a review from gewarren November 24, 2025 23:15
@BillWagner
Copy link
Member Author

Adding @gewarren

Do we want to do anything similar with snippets in the API Reference repo?

@gewarren
Copy link
Contributor

Adding @gewarren

Do we want to do anything similar with snippets in the API Reference repo?

Is this the recommended way to declare extension methods going forward?

@BillWagner
Copy link
Member Author

@gewarren

Is this the recommended way to declare extension methods going forward?

It's a very mild recommendation. The primary driver to use the new syntax is to enable extension operators and extension properties. (More extension member types are planned).

So, like string interpolation, or raw string literals, we want C# developers to see the new syntax more often, and use it, there's no motivation to replace existing methods. The runtime team likely won't update existing extension methods to use the new syntax without other motivating work like adding extension operators to an existing extension library.

For us, how closely do we want our sample code to match the runtime source?

@gewarren
Copy link
Contributor

@gewarren
Is this the recommended way to declare extension methods going forward?

It's a very mild recommendation. The primary driver to use the new syntax is to enable extension operators and extension properties. (More extension member types are planned).

For us, how closely do we want our sample code to match the runtime source?

In that case, I don't think we need to go through and update the existing samples in dotnet-api-docs. There are other more glaring things that might be higher priority to fix (like using exception helpers).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants