Monday, September 26, 2011

Null-coalesce Operator (?? in C# If() in Visual Basic)



It is used to define a default value for a nullable value type as well as a reference type. It returns the left-hand operator if it is not null, otherwise, the right-hand operator.
Syntax in C#: (TestValue ?? DefaultValue)
Syntax in Visual Basic: If(TestValue, DefaultValue)