<?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>What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx</link><description>Admitted, we blew it in the first version of the framework with System.Collections.ICollection , which is next to useless. But we fixed it up pretty well when generics came along in .NET framework 2.0: System.Collections.Generic.ICollection&amp;lt;T&amp;gt; lets</description><dc:language>en</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Ultracet.</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#8763049</link><pubDate>Tue, 22 Jul 2008 06:42:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8763049</guid><dc:creator>Ultracet.</dc:creator><description>&lt;p&gt;Ultracet and coumadin. Ultracet.&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8763049" width="1" height="1"&gt;</description></item><item><title>Collection Initializers</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#7009555</link><pubDate>Sun, 06 Jan 2008 23:19:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7009555</guid><dc:creator>Community Blogs</dc:creator><description>&lt;p&gt;File this in my learn something new every day bucket. I received an email from Steve Maine after he read&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7009555" width="1" height="1"&gt;</description></item><item><title>re: What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#6520486</link><pubDate>Sun, 25 Nov 2007 22:22:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6520486</guid><dc:creator>Chris Sells</dc:creator><description>&lt;p&gt;I couldn't find GetInterfaceTypes, but GetInterfaces seems to do the trick:&lt;/p&gt;
&lt;p&gt;from name in assemblyNames&lt;/p&gt;
&lt;p&gt; &amp;nbsp;select Assembly.LoadWithPartialName(name) into a&lt;/p&gt;
&lt;p&gt; &amp;nbsp;from c in a.GetTypes()&lt;/p&gt;
&lt;p&gt; &amp;nbsp;where c.IsPublic &amp;amp;&amp;amp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; c.GetConstructors().Any(m =&amp;gt; m.IsPublic) &amp;amp;&amp;amp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; c.GetInterfaces().Contains(typeof(ICollection&amp;lt;&amp;gt;)) &lt;/p&gt;
&lt;p&gt; &amp;nbsp;select c.FullName&lt;/p&gt;
&lt;p&gt;However, it's interesting that &lt;/p&gt;
&lt;p&gt;typeof(Dictionary&amp;lt;,&amp;gt;.KeyCollection).GetInterfaces().Contains(typeof(ICollection&amp;lt;&amp;gt;))&lt;/p&gt;
&lt;p&gt;returns False, even though KeyCollection implements ICollection&amp;lt;&amp;gt;. Why would that be?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6520486" width="1" height="1"&gt;</description></item><item><title>An XML Document should be considered a collection...</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#5123650</link><pubDate>Tue, 25 Sep 2007 19:01:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5123650</guid><dc:creator>tourbillon</dc:creator><description>&lt;p&gt;How sad it is that Microsoft doesn't consider an XML document a collection! For example, it is not possible to us a For/Each block to iterate through each element in an XML document using VB or C#. It is possible to do with XSL. &lt;/p&gt;
&lt;p&gt;I've submitted a case (SRZ070705000503) about Microsoft's misconception that everything between the start and end tags of an element is a single element when it is not. That is only true for elements with text content; not xml content (descendants). This case has been escalated for weeks now so I assume that there is some validity to my claim.&lt;/p&gt;
&lt;p&gt;XML would be SO MUCH MORE USEFUL if each element (node) could be dealt with individually without affecting the descendants of the element. A good example would be to delete or move an element leaving the descendants as descendants of the deleted or moved element.&lt;/p&gt;
&lt;p&gt;Consider an XML document with elements that have an attribute called Approved which can be True or False and you want to end up with an XML document that consists only of the elements with Approved=True using an XPath predicate. Currently, this can only be done by converting the XML to a NodeList which loses the hierarchical structure.&lt;/p&gt;
&lt;p&gt;I've recommended that the XMLNode object in the MSXMLDOM get a new property called ExcludeDescendants. That property would be False by default in existing applications that don't have the ExcludeDescendants property so that existing applications would work as they do now. New instances of controls that would be affected such as the XMLDataSource control would have the ability to set that property to True so that individual elements could be manipulated the same way that they can be using XSL.&lt;/p&gt;
&lt;p&gt;If Microsoft were to include an XML document as a collection, that would open up many new potential uses for XML which currently can't be done or require dozens of lines of code to do.&lt;/p&gt;
&lt;p&gt;There are plenty of name/value pair collections, now it's time to provide developers with hierarchical collections!&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5123650" width="1" height="1"&gt;</description></item><item><title>re: What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#3448112</link><pubDate>Thu, 21 Jun 2007 23:56:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3448112</guid><dc:creator>Kirill Osenkov</dc:creator><description>&lt;p&gt;Sorry for being late.&lt;/p&gt;
&lt;p&gt;My personal experience has been that ICollection and the like are not fine-granular enough. The interfaces should be more fine-granular. My rule of thumb is: every interface in the system should have at most one member. Works amazingly since 2003.&lt;/p&gt;
&lt;p&gt;Interfaces should more use interface inheritance to provide more flexibility in distilling out certain facets of the functionality.&lt;/p&gt;
&lt;p&gt;I totally agree with Oli that a special interface is needed, with the only Add(T item) method.&lt;/p&gt;
&lt;p&gt;I don't really like the proposal of Andres Cartin about attributes, this should be solved with interfaces - interfaces are there and can handle it well.&lt;/p&gt;
&lt;p&gt;My own little library includes the IFillable&amp;lt;T&amp;gt; interface with the only method Add(T item). The name (Fillable) isn't probably the best, ICollector might be an option, but the idea served me very well all the time. There are a lot of scenarios where the only thing that we want to do with a parameter is to add an item to it. Almost everywhere, where we use yield return to return a number of items, we can use a parameter of type IFillable. The only difference is that it won't be lazy anymore.&lt;/p&gt;
&lt;p&gt;Some examples from my own &amp;quot;base class library&amp;quot;:&lt;/p&gt;
&lt;p&gt;public interface IFillable&amp;lt;T&amp;gt;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	void Add(T item);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;public interface ISet&amp;lt;T&amp;gt;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	bool Contains(T item);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;public interface IClearable&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	void Clear();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;public class ListSet&amp;lt;T&amp;gt; : List&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	ISet&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	IFillable&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	IClearable&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;public class Set&amp;lt;T&amp;gt; : &lt;/p&gt;
&lt;p&gt;	Dictionary&amp;lt;T, Object&amp;gt;, &lt;/p&gt;
&lt;p&gt;	IEnumerable&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	ISet&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	IFillable&amp;lt;T&amp;gt;,&lt;/p&gt;
&lt;p&gt;	IClearable&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3448112" width="1" height="1"&gt;</description></item><item><title>re: What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#1531935</link><pubDate>Fri, 26 Jan 2007 01:24:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1531935</guid><dc:creator>Mads Torgersen - MSFT</dc:creator><description>&lt;p&gt;LINQ and C# 3.0 have been public since PDC in september 2005, with active forums, blogs, website etc. We got a ton of useful input from the community which has made quite a difference. Welcome to the game :-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1531935" width="1" height="1"&gt;</description></item><item><title>re: What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#1531379</link><pubDate>Thu, 25 Jan 2007 23:07:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1531379</guid><dc:creator>damien morton</dc:creator><description>&lt;p&gt;Why do you microsft guys go public with your language design issues just as you go into lockdown. Surely it would be more meaningful to engage the community at a point where their input can make a difference.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1531379" width="1" height="1"&gt;</description></item><item><title>Community Convergence XIX</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#1518297</link><pubDate>Wed, 24 Jan 2007 03:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1518297</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Welcome to the nineteenth Community Convergence. I'm Charlie Calvert, the C# Community PM, and this is&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1518297" width="1" height="1"&gt;</description></item><item><title>re: What is a collection?</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#1516354</link><pubDate>Tue, 23 Jan 2007 22:27:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1516354</guid><dc:creator>Mads Torgersen - MSFT</dc:creator><description>&lt;p&gt;Thanks again for all your comments. Many of you suggest that we introduce some mechanism (new interface, attributes, special methods etc) to better mark the fact that something &amp;quot;is a collection&amp;quot; and how it should be initialized with a collection initializer. &lt;/p&gt;
&lt;p&gt;This does not address the problem we set out to solve, which is to make collection initialization possible on a number of existing classes without modification. The only suggestion I've seen that does that is the one about allowing colleciton initializers to make use of Add methods added as extension methods.&lt;/p&gt;
&lt;p&gt;We will look at that, but as it is, we are currently finishing up the last bits of coding for Orcas, and can hardly fit any more changes in. Heck we gotta ship at some point. Luckily this is the kind of limitations that we can lift in the next version if the need is there; we are not designing ourselves out of it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1516354" width="1" height="1"&gt;</description></item><item><title>Collection Initializers and Duck Typing</title><link>http://blogs.msdn.com/b/madst/archive/2006/10/10/what-is-a-collection_3F00_.aspx#1237101</link><pubDate>Fri, 08 Dec 2006 09:49:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1237101</guid><dc:creator>Technical Articles</dc:creator><description>&lt;p&gt;Recently I came across a blog post by Mads Torgersen , the project manager for the C# language team at&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1237101" width="1" height="1"&gt;</description></item></channel></rss>