15
Jul
You learn somthing new everyday - that’s what I love about this job… any way the C# null-coalescing operator
You can easily default a value if it is null by doing the following:
string fileName = tempFileName ?? "Untitled";
Very useful - I always prefer to write one line of code rather than many the above is much nicer than:
string fileName = tempFileName != null ? tempFileName : "Untitled";
This is a nice article about this subject: http://davidhayden.com/blog/dave/archive/2006/07/05/NullCoalescingOperator.aspx
0