Wednesday, August 25, 2004

I'll forever chuckle when I read that title.  Maybe you will too after you read this.

I was aware of the Nullable generic struct in the 2.0 CLR, but I only just now figured out that they've built direct support for it into C# 2.0.  This is awesome!  At work, we currently have a whole bunch of structs that add null support to the value types in the CLR.  So we have NullableSingle, NullableDouble, NullableUInt64, etc.  This helps us incredibly to match the database concept of numbers and such that can have null values.

I've been looking forward to Nullable for some time, but now I'm absolutely ecstatic about the C# support for it.  Using the magic question mark, I can declare a value type to be nullable.  For instance:

bool? hasHairOnHead = false;

Now you get the title joke, right? This means that hasHairOnHead can be set to null, not just through Nullable's HasValue method, but by actually setting it to null:

hasHairOnHead = null;

Freaking awesome, eh?  So now, the Headless Horseman's hasHairOnHead value can more accurately express his status. (OK, it was the first example I thought of).  The same goes for null comparisons and such!

Of course now I'll get confused reading documentation...Is that a question or a nullable type?  Just try to decipher this faq: Why don't nullable relational operators return bool? instead of bool?

That little question mark is going to save me alot of headaches.  Now I just have to wait for it to be out of beta. 

posted on Wednesday, August 25, 2004 9:16:14 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
Related posts:
LinqToStdf now on CodePlex
Image Slicer for Deep Zoom in Silverlight 2
Silverlight limitations and Constrained Callvirt in IL
What are the generic Delegates in the framework for?
What is System.__Canon and why is it on my stack?
Adding support for .ashx-based views in ASP.net MVC
Tracked by:
"Canada wanted psychic readers Canada" (Canada wanted psychic readers Canada) [Trackback]
"Zeta Phi Beta Sorority Incorporated" (Zeta Phi Beta Sorority Incorporated) [Trackback]
"grand theft auto sanandreas cheat codes" (grand theft auto sanandreas cheat cod... [Trackback]
"beach scene" (beach scene) [Trackback]
"used boat yamaha" (used boat yamaha) [Trackback]
"Illinois Wedding Limo" (Illinois Wedding Limo) [Trackback]
"adult massage queens craiglist" (adult massage queens craiglist) [Trackback]
"closet layout" (closet layout) [Trackback]
"standardbred canada" (standardbred canada) [Trackback]
"modern holiday cards" (modern holiday cards) [Trackback]
"info on provigil" (info on provigil) [Trackback]
"virginia bass boat dealers" (virginia bass boat dealers) [Trackback]
"casio keyboards" (casio keyboards) [Trackback]
"blue mountain coffee" (blue mountain coffee) [Trackback]
"cable descrambler program" (cable descrambler program) [Trackback]
"embryo adoption" (embryo adoption) [Trackback]
"Ceramic Wall Masks" (Ceramic Wall Masks) [Trackback]
"burns security ToCo" (burns security ToCo) [Trackback]
"dog diseases" (dog diseases) [Trackback]
"sun city self storage" (sun city self storage) [Trackback]
"free trial adult dating phone chat" (free trial adult dating phone chat) [Trackback]
"coffee shop franchise" (coffee shop franchise) [Trackback]
"school signs" (school signs) [Trackback]
"caldissimo osare padre" (caldissimo osare padre) [Trackback]
"cat gift lover unique" (cat gift lover unique) [Trackback]
"Business Card Holders" (Business Card Holders) [Trackback]
"luxury wheels" (luxury wheels) [Trackback]
"homes for sale in nashville" (homes for sale in nashville) [Trackback]
"timeshares hawaii" (timeshares hawaii) [Trackback]
"ekoostic hooka" (ekoostic hooka) [Trackback]