Skip to content

Add an overview of extension members in the What's new in C# 14 article #45859

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

Merged
merged 2 commits into from
Apr 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
proofread
  • Loading branch information
BillWagner committed Apr 18, 2025
commit fe02e589f5d91465d7e2c3b29071bd6dff084e72
4 changes: 2 additions & 2 deletions docs/csharp/whats-new/csharp-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static class Enumerable
}
```

The members in the first extension block are called as though they are instance members of `IEnumerable<TSource>`, for example `sequence.IsEmpty`. The members in the second extension block are called as though they are static members of `IEnumerable<TSource>`, for example `IEnumerable<int>.Identity`.
The members in the first extension block are called as though they're instance members of `IEnumerable<TSource>`, for example `sequence.IsEmpty`. The members in the second extension block are called as though they're static members of `IEnumerable<TSource>`, for example `IEnumerable<int>.Identity`.

You can learn more details by reading the article on [extension members](../programming-guide/classes-and-structs/extension-methods.md) in the programming guide, the language reference article on the [`extension` keyword](../language-reference/keywords/extension.md), and the [feature specification](~/_csharplang/proposals/extensions.md) for the new extension members feature.

Expand Down Expand Up @@ -155,7 +155,7 @@ You can simplify the preceding code using the `?.` operator:
customer?.Order = GetCurrentOrder();
```

The right side of the `=` operator is evaluated only when the left side is not null. If `customer` is null, the code doesn't call `GetCurrentOrder`.
The right side of the `=` operator is evaluated only when the left side isn't null. If `customer` is null, the code doesn't call `GetCurrentOrder`.

In addition to assignment, you can use null conditional member access operators with compound assignment operators (`+=`, `-=`, and others). However, increment and decrement, `++` and `--`, aren't allowed.

Expand Down
Loading