<?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>Why we don’t recommend using List&amp;lt;T&amp;gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx</link><description>We don’t recommend using List&amp;lt;T&amp;gt; in public APIs for two reasons. List&amp;lt;T&amp;gt; is not designed to be extended. i.e. you cannot override any members. This for example means that an object returning List&amp;lt;T&amp;gt; from a property won’t be able to get</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#474016</link><pubDate>Mon, 26 Sep 2005 19:43:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474016</guid><dc:creator>Rob P</dc:creator><description>List&amp;lt;T&amp;gt; has so much useful stuff on it though :)  Stuff, I might add, that is probably implemented using only members from IList (Find, FindAll, etc).&lt;br&gt;&lt;br&gt;I guess we can wait for c# 3 and just extend IList&amp;lt;T&amp;gt; to have all the methods of List&amp;lt;T&amp;gt; we want.</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#474021</link><pubDate>Mon, 26 Sep 2005 19:54:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474021</guid><dc:creator>Kristoffer Henriksson</dc:creator><description>Is there a replacement generic type that you recommend using instead?</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#474122</link><pubDate>Mon, 26 Sep 2005 23:23:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474122</guid><dc:creator>kcwalina</dc:creator><description>We recommend using Collection&amp;lt;T&amp;gt;, ReadOnlyCollection&amp;lt;T&amp;gt;, or KeyedCollection&amp;lt;TKey,TItem&amp;gt; for outputs and properties and interfaces IEnumerable&amp;lt;T&amp;gt;, ICollection&amp;lt;T&amp;gt;, IList&amp;lt;T&amp;gt; for inputs. &lt;br&gt;&lt;br&gt;If you need the List&amp;lt;T&amp;gt; useful APIs on your public API, just inherit from Collection&amp;lt;T&amp;gt; and add these APIs.</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#475341</link><pubDate>Thu, 29 Sep 2005 19:11:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:475341</guid><dc:creator>bowerm</dc:creator><description>Interesting.  So you could say Collection&amp;lt;T&amp;gt; is the Generic equivalent of CollectionBase from v1.1?</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#475577</link><pubDate>Fri, 30 Sep 2005 07:53:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:475577</guid><dc:creator>kcwalina</dc:creator><description>Yes, Collection&amp;lt;T&amp;gt; is just a better CollectionBase. See &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/kcwalina/archive/2005/09/23/Collections.aspx"&gt;http://blogs.msdn.com/kcwalina/archive/2005/09/23/Collections.aspx&lt;/a&gt; for more details.</description></item><item><title>re: Why we don’t recommend using List&amp;lt;T&amp;gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#584488</link><pubDate>Wed, 26 Apr 2006 23:42:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:584488</guid><dc:creator>Michael Primeaux</dc:creator><description>&lt;br&gt;What is the recommended pattern for implementing a synchronized class that inherits from Collection&amp;lt;T&amp;gt;? &amp;nbsp;For example, I want to implement a SyncRoot property of type ReaderWriterLock. I do see where I can override (protected) the methods InsertItem, RemoveItem, ClearItems, and SetItem. However, I do not see an override for GetItem. &lt;br&gt;</description></item><item><title>FAQ: Why does DoNotExposeGenericLists say that I should expose Collection&amp;amp;lt;T&amp;amp;gt; instead of List&amp;amp;lt;T&amp;amp;gt;? [David Kean]</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#585477</link><pubDate>Fri, 28 Apr 2006 00:43:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:585477</guid><dc:creator>Visual Studio Managed Code Analysis (FxCop)</dc:creator><description>DoNotExposeGenericLists fires when I publicly expose a List&amp;amp;amp;lt;T&amp;amp;amp;gt; via a field, method, property, or...</description></item><item><title>re: Why we don’t recommend using List&amp;lt;T&amp;gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#742668</link><pubDate>Wed, 06 Sep 2006 16:15:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:742668</guid><dc:creator>Roger</dc:creator><description>&amp;lt;&amp;lt;We recommend using Collection&amp;lt;T&amp;gt;, ReadOnlyCollection&amp;lt;T&amp;gt;, or KeyedCollection&amp;lt;TKey,TItem&amp;gt; for outputs and properties and interfaces IEnumerable&amp;lt;T&amp;gt;, ICollection&amp;lt;T&amp;gt;, IList&amp;lt;T&amp;gt; for inputs. &amp;gt;&amp;gt;&lt;br&gt;&lt;br&gt;Lets say I have my own collection of Persons deriving from collection&amp;lt;t&amp;gt; where I've added some new functionality... Do you mean that I should return a collection&amp;lt;t&amp;gt; instead of my derived collection type in a method returning Persons? Why? Harder for the clients to get hold of my collection specific API. Or do I misunderstand you? </description></item><item><title>re: Why we don’t recommend using List&amp;lt;T&amp;gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#750913</link><pubDate>Tue, 12 Sep 2006 21:29:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:750913</guid><dc:creator>Perry Rapp</dc:creator><description>Let me ask again a great question above (Michael's), which was apparently never answered:&lt;br&gt;&lt;br&gt;&lt;br&gt;What is the recommended pattern for implementing a synchronized class that inherits from Collection&amp;lt;T&amp;gt;? </description></item><item><title>Data Access Layer 101</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#754004</link><pubDate>Thu, 14 Sep 2006 16:20:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754004</guid><dc:creator>StrangeLog - Il blog di Andrea Saltarello</dc:creator><description /></item><item><title>Data Access Layer 101</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#754006</link><pubDate>Thu, 14 Sep 2006 16:21:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754006</guid><dc:creator>StrangeLog - Il blog di Andrea Saltarello</dc:creator><description>Forse ha ragione David: la mia risposta al post di Giulio (per quanto sintetica e quindi non esaustiva) non </description></item><item><title>Data Access Layer 101</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#754010</link><pubDate>Thu, 14 Sep 2006 16:24:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754010</guid><dc:creator>StrangeLog - Il blog di Andrea Saltarello</dc:creator><description /></item><item><title>re: Why we don’t recommend using List&amp;amp;lt;T&amp;amp;gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#754514</link><pubDate>Thu, 14 Sep 2006 22:11:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:754514</guid><dc:creator>kcwalina</dc:creator><description>Michael and Perry, I will try to write some detailed guidelines on synchronization and post them to this blog. Unfortunatelly I am swampped right now and this is a relativelly large project. But quickly, in most scenarios, we recommend you wrap all collections and other components that need to be synchronized. In some other scenarios where the only resource that needs to be synchronized is the collection, I would simply inherit and add a sync root, optionally override the for protected members that modify Collection&amp;lt;T&amp;gt; and synchronize there.</description></item><item><title>FAQ: Why does DoNotExposeGenericLists recommend that I expose Collection&amp;lt;T&amp;gt; instead of List&amp;lt;T&amp;gt;? [David Kean]</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#820065</link><pubDate>Thu, 12 Oct 2006 19:51:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:820065</guid><dc:creator>Visual Studio Managed Code Analysis (FxCop)</dc:creator><description>&lt;p&gt;DoNotExposeGenericLists fires when I publicly expose List&amp;amp;lt;T&amp;amp;gt; via a field, method, property, or&lt;/p&gt;
</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#835263</link><pubDate>Tue, 17 Oct 2006 19:40:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:835263</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;What would you recommend in this scenario:&lt;/p&gt;
&lt;p&gt;We have a class with an abstract method that is intended to be subclassed by the user of our framework. The method to override should produce a list of items that are determined in an application specific way.&lt;/p&gt;
&lt;p&gt;Is it ok for this method to look like this:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;protected abstract IEnumerable&amp;lt;Item&amp;gt; GetItems(...);&lt;/p&gt;
&lt;p&gt;&amp;gt; We recommend using ... IEnumerable&amp;lt;T&amp;gt;, ... for inputs.&lt;/p&gt;
&lt;p&gt;I would argue that the output from this overridden method is the input to our API, and as such IEnumerable has the least requirements for the implementation.&lt;/p&gt;
&lt;p&gt;How about users that use other languages than C#and VB? As far as I know, generics are CLS compliant. Can everybody override such a method?&lt;/p&gt;</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#2657135</link><pubDate>Wed, 16 May 2007 00:22:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2657135</guid><dc:creator>An Phu</dc:creator><description>&lt;p&gt;What are your recommendations in a webservice context?&lt;/p&gt;</description></item><item><title>Haugerns Development Escapades  &amp;raquo; Blog Archive   &amp;raquo; .Net Collection&amp;lt;T&amp;gt; vs. List&amp;lt;T&amp;gt;</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#6643428</link><pubDate>Mon, 03 Dec 2007 00:21:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6643428</guid><dc:creator>Haugerns Development Escapades  » Blog Archive   » .Net Collection&lt;T&gt; vs. List&lt;T&gt;</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.haugern.net/blog/net-collectiont-vs-listt/"&gt;http://www.haugern.net/blog/net-collectiont-vs-listt/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#8348430</link><pubDate>Tue, 01 Apr 2008 19:51:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8348430</guid><dc:creator>Vladimir Kelman</dc:creator><description>&lt;p&gt;Hi Krzysztof! Sorry for putting it here, but don't you think that there is a small bug in &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/fxcop/archive/2006/04/27/585476.aspx"&gt;http://blogs.msdn.com/fxcop/archive/2006/04/27/585476.aspx&lt;/a&gt; example they put to explain your post? (Comments not allowed there). In class Person they have&lt;/p&gt;
&lt;p&gt;private AddressCollection _Addresses = new AddressCollection(); &lt;/p&gt;
&lt;p&gt;But class AddressCollection does not have such parameterless constructor. The only one available takes Person owner parameter:&lt;/p&gt;
&lt;p&gt;public AddressCollection(Person owner)&lt;/p&gt;</description></item><item><title>Elegant Code &amp;raquo; Replace your Collections with IEnumerable&amp;lt;T&amp;gt;</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#8366356</link><pubDate>Mon, 07 Apr 2008 23:16:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8366356</guid><dc:creator>Elegant Code &amp;raquo; Replace your Collections with IEnumerable&amp;lt;T&amp;gt;</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://elegantcode.com/2008/04/07/replace-your-collections-with-ienumerablet/"&gt;http://elegantcode.com/2008/04/07/replace-your-collections-with-ienumerablet/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#8367023</link><pubDate>Tue, 08 Apr 2008 03:20:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8367023</guid><dc:creator>kcwalina</dc:creator><description>&lt;p&gt;Vladimir, &lt;/p&gt;
&lt;p&gt;thanks for pointing it out. I will email the fxcop team about it.&lt;/p&gt;
</description></item><item><title>  The Missing .NET #2: Collection&amp;lt;T&amp;gt; AddRange() | Jason Kemp .ca</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#8372620</link><pubDate>Wed, 09 Apr 2008 19:03:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8372620</guid><dc:creator>  The Missing .NET #2: Collection&amp;lt;T&amp;gt; AddRange() | Jason Kemp .ca</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.ageektrapped.com/blog/the-missing-net-2-collectiont-addrange/"&gt;http://www.ageektrapped.com/blog/the-missing-net-2-collectiont-addrange/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> &amp;nbsp; Public APIlerde List&amp;nbsp;by&amp;nbsp;eser.ozvataf.com</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#8965392</link><pubDate>Thu, 25 Sep 2008 21:46:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8965392</guid><dc:creator> &amp;nbsp; Public APIlerde List&amp;nbsp;by&amp;nbsp;eser.ozvataf.com</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://eser.ozvataf.com/blog/29"&gt;http://eser.ozvataf.com/blog/29&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Frage zum string [] | hilpers</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9336240</link><pubDate>Sat, 17 Jan 2009 20:45:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9336240</guid><dc:creator>Frage zum string [] | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.com/1205717-frage-zum-string"&gt;http://www.hilpers.com/1205717-frage-zum-string&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Supporto per estrapolare dati | hilpers</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9336513</link><pubDate>Sat, 17 Jan 2009 23:53:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9336513</guid><dc:creator>Supporto per estrapolare dati | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.it/2657139-supporto-per-estrapolare-dati"&gt;http://www.hilpers.it/2657139-supporto-per-estrapolare-dati&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Colllection-Klasse casten | hilpers</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9337666</link><pubDate>Sun, 18 Jan 2009 13:41:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9337666</guid><dc:creator>Colllection-Klasse casten | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.com/1174313-colllection-klasse-casten"&gt;http://www.hilpers.com/1174313-colllection-klasse-casten&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>ArrayList oder String.Concat() ? | hilpers</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9348041</link><pubDate>Tue, 20 Jan 2009 18:37:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9348041</guid><dc:creator>ArrayList oder String.Concat() ? | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.com/269060-arraylist-oder-string-concat"&gt;http://www.hilpers.com/269060-arraylist-oder-string-concat&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Lista de Generics con Eventos | hilpers</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9349986</link><pubDate>Tue, 20 Jan 2009 22:06:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9349986</guid><dc:creator>Lista de Generics con Eventos | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers-esp.com/443042-lista-de-generics-con-eventos"&gt;http://www.hilpers-esp.com/443042-lista-de-generics-con-eventos&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9467974</link><pubDate>Mon, 09 Mar 2009 20:09:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9467974</guid><dc:creator>Phani</dc:creator><description>&lt;p&gt;What is the general recommendation for using List in WCF Operations?&lt;/p&gt;</description></item><item><title>re: Why we don’t recommend using List&lt;T&gt; in public APIs</title><link>http://blogs.msdn.com/kcwalina/archive/2005/09/26/474010.aspx#9913421</link><pubDate>Tue, 27 Oct 2009 10:17:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913421</guid><dc:creator>ae</dc:creator><description>&lt;p&gt;what is recommended in frk 3.5 ?? thanks.&lt;/p&gt;</description></item></channel></rss>