Wednesday 5 December 2012

C# "??" Operator

The "??" operator is called the null-coalescing operator and is used to define a default value for a null able value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand.

objNullable = objNullable ?? new objMyObject();

No comments:

Post a Comment