C Sharp - Inline If

Use ? : to create an inline if statement. For example

1
2
int x=9;
console.log(x == 14 ? 0 : x)

If the value of x = 14, then return 0, otherwise return x

Null Coalescing Operator

Use the ?? operator

For example

1
X ?? y 

Means – if x is non-null, evaluate to x, otherwise Y