Three C# code snippets with the same meaning…
Variant 1: Using a full if/else clause
MyClass result;
if (input!= null)
result= input;
else
result= new MyClass();
Variant 2: Using the ?/: conditional operator
MyClass result = input != null ? input : new MyClass();
Variant 3: Using the ?? operator
MyClass result = input ?? new MyClass();
I did not know about the ?? operator, until Resharper 3 suggested to use variant 3 instead of variant 2
