Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Member access operators and expressions - C# reference"
description: "Learn about C# operators that you can use to access type members."
ms.date: 04/17/2020
ms.date: 11/13/2020
author: pkulikov
f1_keywords:
- "._CSharpKeyword"
Expand Down Expand Up @@ -132,9 +132,6 @@ In the preceding example, if you don't use the `??` operator, `numbers?.Length <

The null-conditional member access operator `?.` is also known as the Elvis operator.

> [!NOTE]
> In C# 8, the [null-forgiving operator](null-forgiving.md) terminates the list of preceding null-conditional operations. For example, the expression `x?.y!.z` is parsed as `(x?.y)!.z`. Due to this interpretation, `z` is evaluated even if `x` is `null`, which may result in a <xref:System.NullReferenceException>.

### Thread-safe delegate invocation

Use the `?.` operator to check if a delegate is non-null and invoke it in a thread-safe way (for example, when you [raise an event](../../../standard/events/how-to-raise-and-consume-events.md)), as the following code shows:
Expand Down
7 changes: 2 additions & 5 deletions docs/csharp/language-reference/operators/null-forgiving.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
description: "! (null-forgiving) operator - C# reference"
title: "! (null-forgiving) operator - C# reference"
ms.date: 10/11/2019
f1_keywords:
ms.date: 11/13/2020
f1_keywords:
- "nullForgiving_CSharpKeyword"
helpviewer_keywords:
- "null-forgiving operator [C#]"
Expand All @@ -14,9 +14,6 @@ Available in C# 8.0 and later, the unary postfix `!` operator is the null-forgiv

The null-forgiving operator has no effect at run time. It only affects the compiler's static flow analysis by changing the null state of the expression. At run time, expression `x!` evaluates to the result of the underlying expression `x`.

> [!NOTE]
> In C# 8, the null-forgiving operator terminates the list of preceding [null-conditional](member-access-operators.md#null-conditional-operators--and-) operations. For example, the expression `x?.y!.z` is parsed as `(x?.y)!.z`. Due to this interpretation, `z` is evaluated even if `x` is `null`, which may result in a <xref:System.NullReferenceException>.

For more information about the nullable reference types feature, see [Nullable reference types](../builtin-types/nullable-reference-types.md).

## Examples
Expand Down