Gotcha C# operator
August 25, 2007 on 3:13 pm | In DotNet |Sometimes I have a positive feeling of “what’ta f…” reading someone else code (at a contrary to negative feeling of the same sort wchich I get way to often). Recenty I’ve found the ?? operator in C#. And really I didnt know it could by used it this way:
string s = null; string s2 = s ?? “remembered”; string s3 = s2 ?? “vorgotten”;
The ?? operator returns the left operand if it not equalls null and the right one when it is. Simple and usefull!
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^


