Wednesday, July 12, 2006

?? Operator - I'm late to the party

{

I shouldn't have glossed over those "new features" ReadMe files for .NET 2.0. Today I found the ?? operator which is probably going to get me into even more trouble than my use of ?: with other developers.

In short, you can test for a null and return an alternative like so:

string test = (myObject ?? "");

Fritz Onion posted about its use with the ViewState some months ago. I'm sorry I missed it then...

}

No comments: