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
<August 2008>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
Archives
Aggregate Me!
RSS 2.0 | Atom 1.0 | CDF
Categories
Blogroll
Contact me
Send mail to the author(s) E-mail
Administration