null-coalescing assignment

The C# ??= operator, which assigns the right-hand value only if the left-hand variable is currently null.

In more detail

_currency ??= defaultCurrency sets a default once and never overwrites a real value. Its sibling ?? returns the right-hand value when the left is null.

Related terms

Taught in

References