<?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: Enum conversion. Why Oh Why?</title>
	<atom:link href="http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=enum-conversion-why-oh-why</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 23:42:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Thomas Weller</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50526</link>
		<dc:creator>Thomas Weller</dc:creator>
		<pubDate>Sat, 21 Nov 2009 03:11:31 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50526</guid>
		<description>Why _should_ this be possible? 
These are two different datatypes, and you have to be explicit about converting them. This concept is called &#039;type safety&#039;...</description>
		<content:encoded><![CDATA[<p>Why _should_ this be possible?<br />
These are two different datatypes, and you have to be explicit about converting them. This concept is called &#8216;type safety&#8217;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50393</link>
		<dc:creator>Ramon</dc:creator>
		<pubDate>Mon, 16 Nov 2009 19:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50393</guid>
		<description>Well I don&#039;t get it why you should not implicitly cast from enum to byte. However, I find it very logical that you need to cast from byte to enum explicitly.</description>
		<content:encoded><![CDATA[<p>Well I don&#8217;t get it why you should not implicitly cast from enum to byte. However, I find it very logical that you need to cast from byte to enum explicitly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Jarrett</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50358</link>
		<dc:creator>Jason Jarrett</dc:creator>
		<pubDate>Sun, 15 Nov 2009 23:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50358</guid>
		<description>&lt;a href=&quot;#comment-50331&quot; rel=&quot;nofollow&quot;&gt;@Pawel Piotrowicz&lt;/a&gt; 
&lt;a href=&quot;#comment-50332&quot; rel=&quot;nofollow&quot;&gt;@Justice&lt;/a&gt; 
&lt;a href=&quot;#comment-50355&quot; rel=&quot;nofollow&quot;&gt;@Steve Py&lt;/a&gt; 

Although it doesn&#039;t appear this way (through the post). I mostly agree with everyone :) - This is the exact feedback I was hoping to receive. 

I spent some time working with some legacy code where just about every &quot;Entity&quot; had a byte property type (that &#039;mapped&#039; to a related Enum type). The conversion of the two back and forth has become extremely annoying, (it&#039;s only 6 characters isn&#039;t just 6 characters in my case - it&#039;s more like wasted time...). Unfortunately I lost sight of some of the ideas given by the good comments made above. 

Thanks everyone for clarifying.</description>
		<content:encoded><![CDATA[<p><a href="#comment-50331" rel="nofollow">@Pawel Piotrowicz</a><br />
<a href="#comment-50332" rel="nofollow">@Justice</a><br />
<a href="#comment-50355" rel="nofollow">@Steve Py</a> </p>
<p>Although it doesn&#8217;t appear this way (through the post). I mostly agree with everyone <img src='http://elegantcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; This is the exact feedback I was hoping to receive. </p>
<p>I spent some time working with some legacy code where just about every &#8220;Entity&#8221; had a byte property type (that &#8216;mapped&#8217; to a related Enum type). The conversion of the two back and forth has become extremely annoying, (it&#8217;s only 6 characters isn&#8217;t just 6 characters in my case &#8211; it&#8217;s more like wasted time&#8230;). Unfortunately I lost sight of some of the ideas given by the good comments made above. </p>
<p>Thanks everyone for clarifying.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hakan Forss</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50357</link>
		<dc:creator>Hakan Forss</dc:creator>
		<pubDate>Sun, 15 Nov 2009 22:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50357</guid>
		<description>In VB.NET i does. This has bitten me once or twice!</description>
		<content:encoded><![CDATA[<p>In VB.NET i does. This has bitten me once or twice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Py</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50355</link>
		<dc:creator>Steve Py</dc:creator>
		<pubDate>Sun, 15 Nov 2009 21:52:41 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50355</guid>
		<description>Because a byte is a byte, and an enum is an enum, regardless of how it is stored.

They drew a line in the sand regarding implicit casting. If it&#039;s too annoying, well, there&#039;s always VB.</description>
		<content:encoded><![CDATA[<p>Because a byte is a byte, and an enum is an enum, regardless of how it is stored.</p>
<p>They drew a line in the sand regarding implicit casting. If it&#8217;s too annoying, well, there&#8217;s always VB.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Sheehan</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50349</link>
		<dc:creator>John Sheehan</dc:creator>
		<pubDate>Sun, 15 Nov 2009 19:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50349</guid>
		<description>You could use a struct instead:

public struct FooNum
{
    public const byte Will = 1;
    ....
}

Since it&#039;s a const, you can still switch on it (although you don&#039;t get the nice VS switch snippet support). Just an option. I do this in a couple places and it works well for those situations.</description>
		<content:encoded><![CDATA[<p>You could use a struct instead:</p>
<p>public struct FooNum<br />
{<br />
    public const byte Will = 1;<br />
    &#8230;.<br />
}</p>
<p>Since it&#8217;s a const, you can still switch on it (although you don&#8217;t get the nice VS switch snippet support). Just an option. I do this in a couple places and it works well for those situations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaito PLL Synthesized Dual Conversion SSB Shortwave Radio with Recordable 256MB MP3 Player, KA1121 &#124; Shortwave Ham Radio</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50344</link>
		<dc:creator>Kaito PLL Synthesized Dual Conversion SSB Shortwave Radio with Recordable 256MB MP3 Player, KA1121 &#124; Shortwave Ham Radio</dc:creator>
		<pubDate>Sun, 15 Nov 2009 16:45:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50344</guid>
		<description>[...] Elegant Code » Enum conversion. Why Oh Why? [...]</description>
		<content:encoded><![CDATA[<p>[...] Elegant Code » Enum conversion. Why Oh Why? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justice</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50332</link>
		<dc:creator>Justice</dc:creator>
		<pubDate>Sun, 15 Nov 2009 08:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50332</guid>
		<description>It *does* just work. It clearly forces you to separate enums from raw types both in your thinking and in your code, and makes the practice of conflating the two much more challenging to pull off accidentally.</description>
		<content:encoded><![CDATA[<p>It *does* just work. It clearly forces you to separate enums from raw types both in your thinking and in your code, and makes the practice of conflating the two much more challenging to pull off accidentally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pawel Piotrowicz</title>
		<link>http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/comment-page-1/#comment-50331</link>
		<dc:creator>Pawel Piotrowicz</dc:creator>
		<pubDate>Sun, 15 Nov 2009 08:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/11/15/enum-conversion-why-oh-why/#comment-50331</guid>
		<description>What&#039;s the problem with:
byte b = (byte)FooEnum.Will;
?

It&#039;s only six characters longer, and it clearly states what it does.</description>
		<content:encoded><![CDATA[<p>What&#8217;s the problem with:<br />
byte b = (byte)FooEnum.Will;<br />
?</p>
<p>It&#8217;s only six characters longer, and it clearly states what it does.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

