Skip to content

Commit 9e4f2e2

Browse files
Update code snippet reference for null assignment (#49299)
1 parent 817cee9 commit 9e4f2e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/csharp/language-reference/operators/member-access-operators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Beginning in C# 14, assignment is permissible with a null conditional access exp
155155

156156
The preceding example shows assignment to a property and an indexed element on a reference type that might be null. An important behavior for this assignment is that the expression on the right-hand side of the `=` is evaluated only when the left-hand side is known to be non-null. For example, in the following code, the function `GenerateNextIndex` is called only when the `values` array isn't null. If the `values` array is null, `GenerateNextIndex` isn't called:
157157

158-
:::code language="csharp" source="snippets/shared/NullCoalescingOperator.cs" id="NullForgivingAssignment":::
158+
:::code language="csharp" source="snippets/shared/NullCoalescingOperator.cs" id="ConditionalRHS":::
159159

160160
In other words, the preceding code is equivalent to the following code using an `if` statement for the null check:
161161

0 commit comments

Comments
 (0)