Null Coalescing Operator

41q0omfytxl-_sx331_bo1204203200_

C# 5.0 in a Nutshell: The Definitive Reference by Definitive Reference Kindle Edition
by Joseph Albahari, Ben Albahari.

The ?? operator:
– can be used with both nullable types and reference types.
– says “If the operand is non-null, give it to me; otherwise, give me a default value.”
– equivalent to calling GetValueOrDefault with an explicit default value, except that the expression for the default value is never evaluated if the variable is not null.

Albahari & Albahari, C# 5.0 In a Nutshell: The Definitive Reference, 156-157.

ページトップへ