Tricky Operator Names in C#
A list of symbol based C# operators, what they do and the links to documentation for times when searching question marks doesn't return what I want.

With more syntactic sugar making its delicious way into ever increasing C# versions, we get symbol based operators with names escape me. Except my friend and I seem to always remember ??
, or the null-coalescing operator. It's a catchy name. ¯\_(ツ)_/¯
This post isn't new and revolutionary. It's a reference post for future me when Google doesn't return the documentation for ?.
. The explanations are just going to be linked and lifted from official Microsoft documentation. Here's to you, future me.
??
The null-coalescing operator ??
returns the value of its left-hand operand if it isn't null
; otherwise, it evaluates the right-hand operand and returns its result. The ??
operator doesn't evaluate its right-hand operand if the left-hand operand evaluates to non-null.
??=
The null-coalescing assignment operator ??=
assigns the value of its right-hand operand to its left-hand operand only if the left-hand operand evaluates to null
. The ??=
operator doesn't evaluate its right-hand operand if the left-hand operand evaluates to non-null.
?:
The conditional operator ?:
, also known as the ternary conditional operator, evaluates a Boolean expression and returns the result of one of the two expressions, depending on whether the Boolean expression evaluates to true
or false
.
?.
The null-conditional operator applies a member access, ?.
, or element access, ?[]
, operation to its operand only if that operand evaluates to non-null; otherwise, it returns null
.
!.
The null-forgiving operator or null-suppression operator tells the compiler/static analysis engine during development time that the value will not be null
.
=>
The =>
token is supported in two forms: as the lambda operator and as a separator of a member name and the member implementation in an expression body definition.
_
Discards are temporary, dummy variables that are intentionally unused in application code.
Bonus Round: LINQ Syntax
You know how LINQ can look like code but can also somewhat look like SQL? They're called Method Syntax and Query Syntax respectively. Docs found here. Though I also find the Method Syntax is often called Fluent Syntax too.
Bonus 2: ? or Nullable Value/Reference Types
Technically not an operator, but ?
is also frustrating to search for. Nullable value docs, nullable reference docs.