The ?? Operator return the left hand operand if it is not null. Else it will return the right hand operand.
if(testObject == null)
{
testObject = new TestObject();
}
return testObject;
The above code can be represented in the following one liner
return testObject ?? new TestObject();
Saturday, January 10, 2009
Subscribe to:
Post Comments (Atom)
1 comment:
Nice post very helpful
DBAKings
Post a Comment