<?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>Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx</link><description>EDIT: Contrary to what people understood from this post, it is NOT a "Do not use Generics" post - I think Generics are a GREAT addition to the language/framework and I use them all the time. It is against a very specific usage of Generics Short Answer:</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>MSDN Blog Postings  &amp;raquo; Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx#8332688</link><pubDate>Mon, 24 Mar 2008 01:58:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8332688</guid><dc:creator>MSDN Blog Postings  » Using a Generic return type that does not appear in the parameter list - when to use it</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://msdnrss.thecoderblogs.com/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it/"&gt;http://msdnrss.thecoderblogs.com/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx#8332714</link><pubDate>Mon, 24 Mar 2008 02:36:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8332714</guid><dc:creator>Jeff Yates</dc:creator><description>&lt;p&gt;While I mostly agree with your points, I am a little concerned that you advocate other people's ignorance as a reason not to do things. &amp;nbsp;Just because others aren't versed in all areas of the language doesn't mean we should dumb down our own coding efforts.&lt;/p&gt;
&lt;p&gt;We should use the powerful elements of C# with care, making sure to apply the right solution in the right situation, but we should never shy away from a good solution because other people may not have learned enough to understand it.&lt;/p&gt;
</description></item><item><title>re: Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx#8332913</link><pubDate>Mon, 24 Mar 2008 06:27:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8332913</guid><dc:creator>kfarmer@microsoft.com</dc:creator><description>&lt;p&gt;Jeff's comment deserves repetition. &amp;nbsp;There are people who specifically avoid learning new or advanced language features, for whatever poor reason they have. &amp;nbsp;For my part, I refuse to let them get away with it. &amp;nbsp;Generics are a valuable skill, and contrary to rumor are *not* difficult to comprehend. [if they are difficult, I recommend a career change, or at least a platform change. &amp;nbsp;I'm not being snooty about this: &amp;nbsp;generics as of .NET 3.5 are much more prominent, and will only continue to spread.]&lt;/p&gt;
&lt;p&gt;Incidentally, be careful not to mistake generic usage. &amp;nbsp;There are a fair number of cases where the type parameter *is* an input argument. &amp;nbsp;Hardcoded, perhaps, but an argument nonetheless. &amp;nbsp;For an example, consider the Cast&amp;lt;T&amp;gt; operator in LINQ -- &amp;nbsp;IEnumerable&amp;lt;T&amp;gt; Cast&amp;lt;T&amp;gt;(this IEnumerable) -- or the OfType&amp;lt;T&amp;gt; operator.&lt;/p&gt;
</description></item><item><title>re: Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx#8332995</link><pubDate>Mon, 24 Mar 2008 07:36:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8332995</guid><dc:creator>Shahar</dc:creator><description>&lt;p&gt;You totally missed my meaning.&lt;/p&gt;
&lt;p&gt;Generics are great and should be used - where it makes sense. I was just pointing out a place where they add nothing but complexity both in understanding and in debugging.&lt;/p&gt;
&lt;p&gt;While Generics are not as powerful as C++ Templates, they are still pretty powerful in what they do and can make code both much more readable, maintainable AND &amp;quot;safer&amp;quot;. Not to talk about potential performance improvements (though in a fair percentage of real-world situations, those are not very significant).&lt;/p&gt;
&lt;p&gt;All I was talking about was this SPECIFIC use of Generics.&lt;/p&gt;
</description></item><item><title>re: Using a Generic return type that does not appear in the parameter list - when to use it</title><link>http://blogs.msdn.com/cumgranosalis/archive/2008/03/23/using-a-generic-return-type-that-does-not-appear-in-the-parameter-list-when-to-use-it.aspx#8336239</link><pubDate>Tue, 25 Mar 2008 21:20:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8336239</guid><dc:creator>Jeff Yates</dc:creator><description>&lt;p&gt;I just wanted to set the record straight. &amp;nbsp;I was not and am not implying Shahar hates generics, in fact, I said I agree with just about everything he said. &amp;nbsp;I was just concerned with the point:&lt;/p&gt;
&lt;p&gt;&amp;quot;It's EXACTLY the same amount of code characters and I am pretty sure more people know how to read/parse casting operators (the (string) bit) than generic type parameters (the &amp;lt;string&amp;gt; bit). So it's the same amount of code (not easier to write), it's using a mechanism that less people know (not easier to understand). &amp;quot;&lt;/p&gt;
&lt;p&gt;This implied that it was good to consider ignorance as a reason not to do something and I wanted it point out that this really shouldn't factor in to programming decisions. Shahar's point was made without this poor justification because, from the other justifications, it is quite clear that using generics IN THIS INSTANCE is the wrong choice, regardless of whether people understand generics or not.&lt;/p&gt;
&lt;p&gt;Right, enough of everyone getting misunderstood. :) &amp;nbsp;Keep blogging! &lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item></channel></rss>