<?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: Substitutability of generic types in .NET</title>
	<atom:link href="http://damieng.com/blog/2006/05/03/substitutabilityofgenerictypesindotnet/feed" rel="self" type="application/rss+xml" />
	<link>http://damieng.com/blog/2006/05/03/substitutabilityofgenerictypesindotnet?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=substitutabilityofgenerictypesindotnet</link>
	<description>A .NET developer in silicon valley</description>
	<lastBuildDate>Sun, 25 Dec 2011 15:10:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Steve</title>
		<link>http://damieng.com/blog/2006/05/03/substitutabilityofgenerictypesindotnet#comment-1482</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 04 May 2006 07:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/05/03/substitutabilityofgenerictypesindotnet.aspx#comment-1482</guid>
		<description>Generally I treat this problem with some caution - often needing to perform conditional behaviour based on typeof() or equivalent is a sign that logic may be in the wrong place. Often this behaviour can be pushed down to the objects themselves through some more generic concept or event behaviour and let polymorphism deal with it. Another way, appropriate if the algorithm is designed to be external to the classes themselves (perhaps because it is pluggable) is with a visitor pattern, where there are multiple overloaded visit(T obj) methods - code flow naturally follows the implementation for the given type. &lt;br /&gt;&lt;br /&gt;Whatever the way, although I do very occasionally use typeof() style logic, I generally feel uncomfortable about it since it normally means I&#039;m not thinking about something the right way. I won&#039;t say I&#039;ve never done it, though ;)</description>
		<content:encoded><![CDATA[<p>Generally I treat this problem with some caution &#8211; often needing to perform conditional behaviour based on typeof() or equivalent is a sign that logic may be in the wrong place. Often this behaviour can be pushed down to the objects themselves through some more generic concept or event behaviour and let polymorphism deal with it. Another way, appropriate if the algorithm is designed to be external to the classes themselves (perhaps because it is pluggable) is with a visitor pattern, where there are multiple overloaded visit(T obj) methods &#8211; code flow naturally follows the implementation for the given type. </p>
<p>Whatever the way, although I do very occasionally use typeof() style logic, I generally feel uncomfortable about it since it normally means I&#8217;m not thinking about something the right way. I won&#8217;t say I&#8217;ve never done it, though ;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

