Xperimentality

Building a Better Xperience with .NET

 Monday, November 21, 2005
I just ran across something I guess I have just been missing in playing with the 2.0 framework: The coalescing operator! I love this. Not sure how I have been missing this one. I am a big fan of using something like:

Textbox.Text = (str == null) ? "N/A" : str;

as opposed to using a conditional block. But I just found that I can use:

Textbox.Text = str ?? "N/A";

It is the simple things that make me the happiest! Well, on to finding more things that I have not discovered yet...
Comments are closed.
Who Am I - Todd Miranda
Me
MVP Visual Developer - ASP/ASP.NET
Search
Links
On this page....
Calendar
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Archives
Aggregate Me!
RSS 2.0 | Atom 1.0 | CDF
Categories
Blogroll
Contact me
Send mail to the author(s) E-mail
Administration