<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Nullable&amp;lt;bool&amp;gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx</link><description>I am starting to work on some updates to the framework design guidelines related to new framework and language features added in .NET 2.0, 3.0, and 3.5. One of such additions are the nullable types (Nullable&amp;lt;T&amp;gt;). Coincidentally, somebody asked me</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#2300476</link><pubDate>Fri, 27 Apr 2007 18:34:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2300476</guid><dc:creator>joshwil</dc:creator><description>&lt;p&gt;The example given seems like a perfect excuse to return an enum.&lt;/p&gt;</description></item><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#2301254</link><pubDate>Fri, 27 Apr 2007 20:21:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2301254</guid><dc:creator>JoshCh</dc:creator><description>&lt;p&gt;How about getting ADO.NET to properly support nullable types? &amp;nbsp;It would save a ton of a code to be able to have the DBNull.Value handled as a normal null in the following case:&lt;/p&gt;
&lt;p&gt;long? id = (long?)dataReader[&amp;quot;id&amp;quot;];&lt;/p&gt;
&lt;p&gt;If dataReader[&amp;quot;id&amp;quot;] is DBNull, id gets set to null. &amp;nbsp;This way nullables become much more useful.&lt;/p&gt;</description></item><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#2303606</link><pubDate>Sat, 28 Apr 2007 00:19:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2303606</guid><dc:creator>Michael Neel</dc:creator><description>&lt;p&gt;No, no and no. &amp;nbsp;No.&lt;/p&gt;
&lt;p&gt;=)&lt;/p&gt;
&lt;p&gt;Oracle does this - conditions can return true, false, or null (if a value in the expression was null). &amp;nbsp;This is one of those things that lead to weird bugs you don't expect - and isn't often thought of in the first round of unit tests.&lt;/p&gt;
&lt;p&gt;If you have a third meaning, make an Enum so it's clear what the three states mean. &amp;nbsp;&lt;/p&gt;</description></item><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#2323016</link><pubDate>Sun, 29 Apr 2007 11:40:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2323016</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Only if the third value is FileNotFound.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://worsethanfailure.com/Articles/What_Is_Truth_0x3f_.aspx"&gt;http://worsethanfailure.com/Articles/What_Is_Truth_0x3f_.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#2520402</link><pubDate>Thu, 10 May 2007 12:03:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2520402</guid><dc:creator>Thanuja</dc:creator><description>&lt;p&gt;Well in the attribute example i think if the attribute is not found you should return and exception as it is an impt info for the upper layers(if layered patterned is used)&lt;/p&gt;</description></item><item><title>re: Nullable&lt;bool&gt; usage guideline</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/27/NullableOfBool.aspx#8519887</link><pubDate>Tue, 20 May 2008 01:49:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519887</guid><dc:creator>Andrei Rinea</dc:creator><description>&lt;p&gt;@JoshCh:&lt;/p&gt;
&lt;p&gt;Regarding :&lt;/p&gt;
&lt;p&gt;long? id = (long?)dataReader[&amp;quot;id&amp;quot;];&lt;/p&gt;
&lt;p&gt;are you sure if dataReader[&amp;quot;id&amp;quot;] is going to be DBNull.Value (the sole instance of the DBNull class) then it will be castable to &amp;quot;long?&amp;quot;? As far as I know that will throw an InvalidCastException.&lt;/p&gt;</description></item></channel></rss>