<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How do you convert your bool to a bit (1 or 0) value?</title>
	<atom:link href="http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/feed/" rel="self" type="application/rss+xml" />
	<link>http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/</link>
	<description>Straight from the mind of geniuseseses....</description>
	<lastBuildDate>Thu, 29 Jul 2010 06:56:25 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: GP</title>
		<link>http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/comment-page-1/#comment-11032</link>
		<dc:creator>GP</dc:creator>
		<pubDate>Mon, 02 Nov 2009 17:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/#comment-11032</guid>
		<description>Here&#039;s something I use-

bool boolvariable = args.Length &gt; 0 ? int.TryParse(args[0], out outnum) ? Convert.ToBoolean(Convert.ToByte(args[0])) : Convert.ToBoolean(args[0]) : true;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s something I use-</p>
<p>bool boolvariable = args.Length &gt; 0 ? int.TryParse(args[0], out outnum) ? Convert.ToBoolean(Convert.ToByte(args[0])) : Convert.ToBoolean(args[0]) : true;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/comment-page-1/#comment-7209</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Tue, 21 Jul 2009 19:07:55 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/#comment-7209</guid>
		<description>byte /*or int*/ v = 1;
bool b = Convert.ToBoolean(v);</description>
		<content:encoded><![CDATA[<p>byte /*or int*/ v = 1;<br />
bool b = Convert.ToBoolean(v);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/comment-page-1/#comment-1710</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 24 Nov 2008 20:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/#comment-1710</guid>
		<description>Quite correct young man when dealing with a DB, however this scenario was not the impetus for such an article.</description>
		<content:encoded><![CDATA[<p>Quite correct young man when dealing with a DB, however this scenario was not the impetus for such an article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gerrod</title>
		<link>http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/comment-page-1/#comment-1703</link>
		<dc:creator>gerrod</dc:creator>
		<pubDate>Mon, 24 Nov 2008 09:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/2008/11/24/how-do-you-convert-your-bool-to-a-bit-1-or-0-value/#comment-1703</guid>
		<description>It depends on why you&#039;re doing the conversion.

If it&#039;s simply to pass in to a byte field in the database, you can just pass it as a boolean and let the framework handle the conversion for you. Not sure how this works with a nullable bool and a NULL DB field, though...

But in general I think I&#039;d go with the Convert.ToByte as well; that&#039;s my usual fallback when there is no implicit (/explicit) cast operator defined.</description>
		<content:encoded><![CDATA[<p>It depends on why you&#8217;re doing the conversion.</p>
<p>If it&#8217;s simply to pass in to a byte field in the database, you can just pass it as a boolean and let the framework handle the conversion for you. Not sure how this works with a nullable bool and a NULL DB field, though&#8230;</p>
<p>But in general I think I&#8217;d go with the Convert.ToByte as well; that&#8217;s my usual fallback when there is no implicit (/explicit) cast operator defined.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
