?? Null-Coalescing Operator

suggest change

The Null-Coalescing operator ?? will return the left-hand side when not null. If it is null, it will return the right-hand side.

object foo = null;
object bar = new object();

var c = foo ?? bar;
//c will be bar since foo was null

The ?? operator can be chained which allows the removal of if checks.

//config will be the first non-null returned.
var config = RetrieveConfigOnMachine() ??
             RetrieveConfigFromService() ??
             new DefaultConfiguration();

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Operators:
* Syntax
* sizeof
* ?? Null-Coalescing Operator
* typeof

Table Of Contents
2 Operators
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script