You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Refassignment* assignsthe *reference* ofitsrighthandoperatortoitslefthandoperand. Theleftoperandisanaliastotherightoperand. Theleftoperandmustbea [reflocal](../keywords/ref.md#ref-locals), [refreadonlylocal](../keywords/ref.md#ref-readonly-locals) or `ref` fieldina [`refstruct`]../builtin-types/ref-struct.md). The following example demonstrates the usage of the ref assignment operator:
This is called *ref assignment*: The variable now refers to a different object.
43
+
Intheprecedingexample, thereflocal `arrayElement`variableisinitializedasanaliastothefirstarrayelement. Then, it's reassigned to become an alias to the last array element. As it'sanalias, whenyouupdateitsvaluewithanordinaryassignmentoperator `=`, thecorrespondingarrayelementisalsoupdated.
44
44
45
45
## Compound assignment
46
46
@@ -78,7 +78,7 @@ For more information about the ref assignment operator `= ref`, see the [feature
78
78
79
79
## See also
80
80
81
-
- [Use compound assignment (style rules IDE0054 and IDE0074)](../../../fundamentals/code-analysis/style-rules/ide0054-ide0074.md)
0 commit comments