TrueWill (14) [Avatar] Offline
#1
"a product with an unknown price will be considered to be less expensive than $10, which is probably what we'd want."

I don't believe the above statement is correct.

decimal? price = null;

if (price < 10m)
{
Console.WriteLine("Null is less than 10");
}

The above code won't print anything. Comparing to null returns false. This is similar to the empty result set you'd get from an equivalent SQL query (ignoring the implications of UNKNOWN for the moment).
TrueWill (14) [Avatar] Offline
#2
Re: Errata p. 13 section 1.1.4
Actually I'm going to correct myself. The example code is returning matches where p.Price > 10, so null would be considered less than or equal to $10 in this case (that is, excluded from the result set).

So it's not truly errata, but I did find it jarring. To me, the statement implies the false statement that null < 10.

Thanks for listening!
jon.skeet (448) [Avatar] Offline
#3
Re: Errata p. 13 section 1.1.4
Thanks for the comments - I see what you'll mean. I'll add an entry to my list of errata (http://csharpindepth.com/Errata.aspx if you weren't aware) for a language improvement. It's not the kind of thing that's likely to make it into revisions for just another printing, but if we do a full second edition (e.g. to support C# 4 when that comes out!) we'll try to improve things more at that point.

Thanks for paying such close attention, and I hope you enjoy the rest of the book!
Jon