<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.wintellect.com/CS/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>Peter Golde's Blog</title><link>http://www.wintellect.com/CS/blogs/pgolde/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Hidden powers of OrderedSet/OrderedBag</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2006/01/03/hidden-powers-of-orderedset-orderedbag.aspx</link><pubDate>Tue, 03 Jan 2006 21:16:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2858</guid><dc:creator>pgolde</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2858.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2858</wfw:commentRss><description>&lt;P&gt;In a comment, Stuart Ballard wrote:&lt;/P&gt;
&lt;P&gt;The general idea of a class that is usable both as a List and a Dictionary, maintaining an order and providing efficient access by both index and key, is a very useful one. &lt;/P&gt;
&lt;P&gt;Althought it's not immediately obvious, the OrderedSet and OrderedBag collections can be used to do just that with just a small amount of work. An OrderedSet can be efficiently indexed just by using the indexer provided on the class. In addition, it can be used as an arbitrary (read-only) IList by simply calling the AsList method.&lt;/P&gt;
&lt;P&gt;Now, it is true that an OrderedSet isn't really a dictionary. But, it can be used effectively as a dictionary by instantiating an OrderedSet&amp;gt;, and passing a Comparison delegate that compares keys only.&lt;/P&gt;
&lt;P&gt;In retrospect, this could perhaps have been made even simpler by having an AsList method on OrderedDictionary that returned an IList&amp;gt;. I considered similar ideas but decided that they seemed too complicated and obscure. Maybe I was wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2858" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Power Collections 1.0 for .NET 2.0 RTM</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/11/11/power-collections-1-0-for-net-2-0-rtm.aspx</link><pubDate>Sat, 12 Nov 2005 00:30:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2859</guid><dc:creator>pgolde</dc:creator><slash:comments>11</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2859.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2859</wfw:commentRss><description>&lt;P&gt;I've posted an updated Power Collections 1.0 that has been recompiled (with slight source changes to address some base class library changes) for the released version of .NET 2.0. No new functionality has been added, nor has the documentation changed.&lt;/P&gt;
&lt;P&gt;As usual, &lt;A href="http://www.wintellect.com/MemberOnly/PowercollectionsAttachments/PowerCollections.zip"&gt;the download is available here.&lt;/A&gt;&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2859" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Power Collections 1.0 released</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/21/power-collections-1-0-released.aspx</link><pubDate>Tue, 21 Jun 2005 05:49:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2866</guid><dc:creator>pgolde</dc:creator><slash:comments>16</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2866.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2866</wfw:commentRss><description>&lt;P&gt;The release of Power Collections 1.0 is complete. There aren't many changes since the beta release a few weeks ago; mainly some updates to the tests and OrderedDictionary had a method renamed (Merge to AddMany).&lt;/P&gt;
&lt;P&gt;As soon as I have more information and thoughts about what happens next with Power Collections, I'll post some more information. But this is where development will stop at least for a little while. I'll still be around to answer questions in the forums and so forth.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wintellect.com/powercollections/download.aspx"&gt;The download is available here&lt;/A&gt;, and the documentation &lt;A href="http://www.wintellect.com/powercollections/documentation/Wintellect.PowerCollections.html"&gt;can be browsed here&lt;/A&gt;. Enjoy!&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2866" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Other minor changes in the last drop</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/08/other-minor-changes-in-the-last-drop.aspx</link><pubDate>Wed, 08 Jun 2005 22:21:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2871</guid><dc:creator>pgolde</dc:creator><slash:comments>2</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2871.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2871</wfw:commentRss><description>&lt;P&gt;A few other minor changes were in the latest drop that I didn't cover in my other posts:&lt;/P&gt;
&lt;P&gt;1. Added a CLSCompliant attribute to the assembly.&lt;/P&gt;
&lt;P&gt;2. The Pair struct added explicit conversions to and from KeyValuePair.&lt;/P&gt;
&lt;P&gt;3. Set, Bag, OrderedSet, and OrderedBag added an IsDisjointFrom method.&lt;/P&gt;
&lt;P&gt;4. Deque added a Clone method.&lt;/P&gt;
&lt;P&gt;5. Deque and BigList added a CloneContents method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2871" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Nomenclature and new methods in Algorithms</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/08/nomenclature-and-new-methods-in-algorithms.aspx</link><pubDate>Wed, 08 Jun 2005 22:18:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2873</guid><dc:creator>pgolde</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2873.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2873</wfw:commentRss><description>&lt;P&gt;As I looked over all the methods in Algorithms, it seemed like I needed to be more disciplined in naming conventions so that the operations of methods would be more consistent and easy to understand. So I developed a nomenclature that I could attempt to use consistently across all the methods in Algorithms. Here's what I came up with:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;First&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that a method returns the first item of some subset of items.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Last&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;:&amp;nbsp;Indicates that a method returns the last item of some subset of items.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Index&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt; (plural: &lt;B&gt;&lt;SPAN style="FONT-WEIGHT:bold;"&gt;Indices&lt;/SPAN&gt;&lt;/B&gt;):&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt; Indicates that a method returns the index in a list. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;At&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that a method operates at a particular index in a list.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Is&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that a method returns a boolean value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Try: &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Indicates that a method returns a boolean value, indicating if the operation was successful or not. Uses an out parameter to return the value upon success.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;SPAN style="BACKGROUND:#ffbfbf;COLOR:#000000;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Where&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that a method takes a Predicate to restrict an operation to items &lt;SPAN style="BACKGROUND:#ffbfbf;COLOR:#000000;"&gt;where&lt;/SPAN&gt; the predicate is true.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Many&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that a method operates on a (non-consecutive) collection of items passed as a parameter. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Range&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that method operates on a consecutive range of items in the collection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Set&lt;/SPAN&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Indicates that method operates on the item without regard to order.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN-LEFT:0.7in;TEXT-INDENT:-0.7in;"&gt;&lt;B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-WEIGHT:bold;FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;All&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face=Verdana size=1&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;: Used SPARINGLY, since it is confusing what it refers to. When used, indicates all of the items currently in the collection. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;There are a number of renamings in Algorithms in the latest drop to conform to this nomenclature. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Verdana;"&gt;Also, I added two new methods that return IEqualityComparer instances: GetCollectionEqualityComparer and GetSetEqualityComparer. These methods create IEqualityComparer instances that compare entire collections as single items. These are useful, for example, if you want a collection of items to be a key for a Dictionary. GetCollectionEqualityComparer compares collections with order to items being significant, GetSetEqualityComparer compares collections as insignificant to order.&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2873" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Unsealing of collection classes</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/08/unsealing-of-collection-classes.aspx</link><pubDate>Wed, 08 Jun 2005 22:07:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2874</guid><dc:creator>pgolde</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2874.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2874</wfw:commentRss><description>&lt;P&gt;In prior releases, all the collection classes were sealed, which prevent people from deriving from them. Although I still don't think that there are many good scenarios where it make sense to derive from Set, Bag, BigList, etc., I have unsealed them in the latest drop. &lt;/P&gt;
&lt;P&gt;This allows people to derive from them and add new methods; perhaps some specific new algorithm or some such.&lt;/P&gt;
&lt;P&gt;However, most methods on these classes remain non-virtual. Why? Basically, because the implementation of these methods is very specific, and it is not possible to override them and change functionality without breaking the core class. Even if the overriding method calls the base, you could find that functionalitybreaks in subtle ways.&lt;/P&gt;
&lt;P&gt;For example, suppose you could override Set.Remove, so that you could&amp;nbsp;do something special whenever an item is removed from a set. This override will be called when people remove items from a Set with the Remove method, but there are lots of other methods that&amp;nbsp;remove items from a Set. Some of these ways (like RemoveMany) internally call Remove, others (like IntersectionWith or Clear) do not. You can't predict, and it might even change in future versions of the library. &lt;/P&gt;
&lt;P&gt;If you need a specialized kind of collection, the &amp;#8220;right&amp;#8221; way to do it is to derive from CollectionBase, ListBase, or DictionaryBase, and override the appropriate methods. This can then delegate to a private instance of some collection as needed. &lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2874" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>More methods in CollectionBase, ListBase, etc</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/08/more-methods-in-collectionbase-listbase-etc.aspx</link><pubDate>Wed, 08 Jun 2005 21:56:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2876</guid><dc:creator>pgolde</dc:creator><slash:comments>8</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2876.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2876</wfw:commentRss><description>&lt;P&gt;I did a review on CollectionBase, ListBase, DictionaryBase (and their read-only equivalents), and realized that a lot of the delegate-based methods that were added to List&amp;lt;T&amp;gt; really made sense on these classes. If you used these classes as bases to create your own collections, you now get a bunch more functionality &amp;#8220;for free&amp;#8221;.&lt;/P&gt;
&lt;P&gt;I decided that it was best to use the exact same names that Microsoft used, even though I don't think that are the best possible names. This should easy the learning curve and make things more consistent for the user.&lt;/P&gt;
&lt;P&gt;Doing this also allow removal of a lot of equivalent methods from the specific collection classes like Set, Bag, etc. &lt;/P&gt;
&lt;P&gt;The new methods added are:&lt;/P&gt;
&lt;P&gt;CollectionBase.AsReadOnly&lt;BR&gt;CollectionBase.Exists&lt;BR&gt;CollectionBase.TrueForAll&lt;BR&gt;CollectionBase.FindAll&lt;BR&gt;CollectionBase.RemoveAll&lt;BR&gt;CollectionBase.ForEach&lt;BR&gt;CollectionBase.ConvertAll&lt;BR&gt;CollectionBase.CountWhere&lt;BR&gt;DictionaryBase.AsReadOnly&lt;BR&gt;ListBase.AsReadOnly&lt;BR&gt;ListBase.CopyTo&lt;BR&gt;ListBase.FindFirst&lt;BR&gt;ListBase.FindLast&lt;BR&gt;ListBase.TryFindFirst&lt;BR&gt;ListBase.TryFindLast&lt;BR&gt;ListBase.FindAll&lt;BR&gt;ListBase.FindIndex&lt;BR&gt;ListBase.FindLastIndex&lt;BR&gt;ListBase.IndexOf&lt;BR&gt;ListBase.LastIndexOf&lt;/P&gt;
&lt;P&gt;(and read-only equivalents, where applicable).&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2876" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Indexer on OrderedSet and OrderedBag</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/06/indexer-on-orderedset-and-orderedbag.aspx</link><pubDate>Mon, 06 Jun 2005 19:13:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2877</guid><dc:creator>pgolde</dc:creator><slash:comments>2</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2877.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2877</wfw:commentRss><description>&lt;P&gt;One interesting feature that was added in the latest drop is the support for accessing OrderedSet and OrderedBag by integer index. Recall that OrderedSet and OrderedBag maintain all the items in order, where order is defined by an IComparer or Comparison. When you could always iterate over the items in order, you can now get at any item by its integer index in the order. This operation takes time O(log N). You can also go this other way; you get do an IndexOf operation on an item to get its index in O(log N) time also.&lt;/P&gt;
&lt;P&gt;The implementation of this is primary in the RedBlackTree class, and it's a little bit interesting and tricky. Each node in the tree stores the number of items in that sub-tree. As items as added or deleted, the counts are updated. One annoying part has to do with adds and deletes that don't complete as expected. For example, consider that operation of deleting an item. As we go down the tree searching for the item to delete, we update the counts in the nodes to reflect the deletion. However, if the item to delete is not found, we have to restore those counts back to where they were. This means that we have to keep a record of what counts were updated, so that they can be restored.&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2877" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Beta of PowerCollections 1.0 now available</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/06/03/beta-of-powercollections-1-0-now-available.aspx</link><pubDate>Fri, 03 Jun 2005 23:05:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2879</guid><dc:creator>pgolde</dc:creator><slash:comments>2</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2879.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2879</wfw:commentRss><description>&lt;P&gt;I've uploaded a new drop of Power Collections. This is quite close to what will be released as the 1.0 release of Power Collections, there are just a few more things to do (mainly making the classes serializable). You can consider this the &amp;#8220;Beta&amp;#8220; release of PowerCollection 1.0. Any feedback that can be provided will be very useful to getting the final 1.0 release as good as possible. I'm aiming toward the 1.0 release at the end of June. I'm short of time right this minute; I'll post more details soon on the changes since the last drop.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wintellect.com/powercollections/download.aspx"&gt;The download is available here&lt;/A&gt;, and the documentation &lt;A href="http://www.wintellect.com/powercollections/documentation/Wintellect.PowerCollections.html"&gt;can be browsed here&lt;/A&gt;. &lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2879" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>IList, ICollection and IsReadOnly</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/05/12/ilist-icollection-and-isreadonly.aspx</link><pubDate>Thu, 12 May 2005 19:18:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2900</guid><dc:creator>pgolde</dc:creator><slash:comments>13</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2900.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2900</wfw:commentRss><description>&lt;P&gt;An interesting discussion &lt;A href="http://wintellect.com/WEBLOGS/pgolde/archive/2005/04/20/1006.aspx#FeedBack"&gt;has been occurring in comments&lt;/A&gt;, and &lt;A href="http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d4be148f-2fe2-4575-b0c0-cc7f61f339a7"&gt;in this bug report&lt;/A&gt;, about the problems with IList and arrays that I discussed earlier.&lt;/P&gt;
&lt;P&gt;I think the discussion has correctly focussed in on a key problem: that the IsReadOnly property on ICollection&amp;lt;T&amp;gt; is too general to take into account the different kinds of changes that can be made to a list. Having identified this problem, however, does not necessarily mean that we need to proliferate into a huge number of different &amp;#8220;Is/Can&amp;#8221; properties. Instead, we should look at the implementations that actually make sense and put in enough properties to handle the realistic cases.&lt;/P&gt;
&lt;P&gt;In the case of ICollection&amp;lt;T&amp;gt; and IList&amp;lt;T&amp;gt;, my feeling is that two properties would handle all the interesting cases easily:&lt;/P&gt;
&lt;P&gt;1. ICollection&amp;lt;T&amp;gt; should change IsReadOnly to CanAddRemove. If true, this would indicate that items can be added to or removed from the collection using the &amp;#8220;Add&amp;#8221;, &amp;#8220;Remove&amp;#8221;, and &amp;#8220;Clear&amp;#8221; methods on ICollection. If false, this would indicate that Add, Remove, and Clear should not be called (however, other methods of changing the collection might work).&lt;/P&gt;
&lt;P&gt;2. IList&amp;lt;T&amp;gt; should add CanChangeValues to indicate that values in the list can be changed using the indexer. If true, the set accessor on the indexer can be used to change the value at a particular index. If false, the set accessor on the indexer should not be used. If both CanAddRemove and CanChangeValues are true, then Insert and RemoveAt can be used to insert or remove values at a particular place. &lt;/P&gt;
&lt;P&gt;These two properties allow all of the interesting cases that I can think of:&lt;/P&gt;
&lt;P&gt;read/write List&amp;lt;T&amp;gt;: CanAddRemove=true, CanChangeValues=true&lt;/P&gt;
&lt;P&gt;read/write array: CannAddRemove=false, CanChangeValues=true&lt;/P&gt;
&lt;P&gt;read-only List&amp;lt;T&amp;gt;: CanAddRemove=false, CanChangeValues=false&lt;/P&gt;
&lt;P&gt;OrderedSet&amp;lt;T&amp;gt;: CanAddRemove=true, CanChangeValues=false (This is the case where items can be added to the collection, but the order in the collection is fixed by the values. Thus, you cannot change the value at a particular index, or insert at a particular index, but you can add or remove values at an unspecified location).&lt;/P&gt;
&lt;P&gt;[For similar reasons, IDictionary&amp;lt;K,V&amp;gt; should include a CanChangeValues that indicates whether the value associated with a key can be changed. This allows the case where a dictionary as a fixed set of keys, but the values associated with the keys can be changed.]&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2900" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Beta 2 drop is now available</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/05/09/beta-2-drop-is-now-available.aspx</link><pubDate>Mon, 09 May 2005 20:49:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2906</guid><dc:creator>pgolde</dc:creator><slash:comments>6</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2906.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2906</wfw:commentRss><description>&lt;P&gt;I've finally completed a drop of Power Collections for Visual Studio 2005 Beta 2. &lt;A href="http://www.wintellect.com/powercollections/download.aspx"&gt;The download is available here&lt;/A&gt;, and the documentation &lt;A href="http://www.wintellect.com/powercollections/documentation/Wintellect.PowerCollections.html"&gt;can be browsed here&lt;/A&gt;. Sorry this took so long to get posted; I was delayed first by the IList problem with arrays, then by some technical problems with the Wintellect FTP server.&lt;/P&gt;
&lt;P&gt;This drop has all the changes needed to work with Beta 2. All of the algorithms that want to change IList&amp;lt;T&amp;gt; contents have been updated to special case arrays to still work, either internally or through overloads.&lt;/P&gt;
&lt;P&gt;Additionally, the MultiCollections have been updated to implement IDictionary&amp;lt;TKey, ICollection&amp;lt;TValue&amp;gt;&amp;gt; instead of IDictionary&amp;lt;TKey, IEnumerable&amp;lt;TValue&amp;gt;&amp;gt;. This was a suggestion I received through the comments on this weblog, and it made these collections significantly better.&lt;/P&gt;
&lt;P&gt;Please give it a try and let me know what you think!&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2906" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Arrays and IList&lt;T&gt;</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/04/20/arrays-and-ilist-t.aspx</link><pubDate>Wed, 20 Apr 2005 18:41:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2912</guid><dc:creator>pgolde</dc:creator><slash:comments>21</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2912.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2912</wfw:commentRss><description>&lt;P&gt;As I was updating Power Collections to use Beta 2, I found an somewhat unfortunate change that had been made since Beta 1. Arrays in .NET have always implemented the IList interface, so you have always been able to convert an int[], say, to an IList, and use that IList to read and write the elements of the array. This is very useful, because you can write algorithms that take an IList, and use that IList without knowing whether they are using an array of object, an array of string, an array of ints, an ArrayList, or any other kind of object that implements IList.&lt;/P&gt;
&lt;P&gt;With the advent of generics, there is now a generic IList&amp;lt;T&amp;gt; interface, which can be specialized to describe lists of any specific type. For example, IList&amp;lt;int&amp;gt; allows reading and writing a list-like object that can only contains ints. Now, it makes total sense that int[] should implement IList&amp;lt;int&amp;gt;, string[] should implement IList&amp;lt;string&amp;gt;, etc. And, in fact, this is the case in both Beta 1 and in Beta 2. This is great, because it means that all of the algorithms in Algorithms that take a parameter of IList&amp;lt;T&amp;gt; can be used on arrays, as well as other collections.&lt;/P&gt;
&lt;P&gt;However, this support was made more limited in Beta 2. In Beta 2, when you get the IList&amp;lt;T&amp;gt; interface on an array, it is a &lt;STRONG&gt;read-only&lt;/STRONG&gt; list. This means that you can read items in the array, but you cannot change the array via the IList&amp;lt;T&amp;gt; interface. The IList&amp;lt;T&amp;gt;.ReadOnly property returns true to indicate this, and using the indexer to change an item throws an NotSupportedException. After some searching around, &lt;A href="http://blogs.msdn.com/bclteam/archive/2004/11/19/267089.aspx"&gt;I found a posting from the BCL team that described this limitation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The upshot is that you can stiill use non-modifying generic algorithms on an array (for example, Algorithms.LastIndexOf). However, a generic algorithm that modifies the list (for example, Algorithms.StableSortInPlace) cannot be used directly on an array. An annoying limitation, to be sure.&lt;/P&gt;
&lt;P&gt;My current thinking is to provide a method on Algorithms that creates a read-write IList&amp;lt;T&amp;gt; wrapper on an array. Something like:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;IList&amp;lt;T&amp;gt; AsReadWriteList(T[] array);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Other ideas (or a better name) welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2912" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>VS Beta 2 is released</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/04/19/vs-beta-2-is-released.aspx</link><pubDate>Tue, 19 Apr 2005 17:02:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2929</guid><dc:creator>pgolde</dc:creator><slash:comments>4</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2929.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2929</wfw:commentRss><description>&lt;A href="http://lab.msdn.microsoft.com/vs2005/"&gt;Visual Studio Beta 2 and Visual C# Express Beta 2 are finally available&lt;/A&gt;. I'm downloading and installing now, and will be posting an updated Power Collections as soon as I am able.&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2929" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>ToString() on collections</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/04/12/tostring-on-collections.aspx</link><pubDate>Tue, 12 Apr 2005 18:50:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2936</guid><dc:creator>pgolde</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2936.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2936</wfw:commentRss><description>&lt;P&gt;I got a lot of &lt;A href="http://wintellect.com/WEBLOGS/pgolde/archive/2004/12/28/721.aspx"&gt;great feedback&lt;/A&gt; on ToString and how it should work on collections. Based on that feedback, I've modified my implementation some and made it significantly better, I think:&lt;/P&gt;
&lt;P&gt;1) Several people raised concerns that having ToString return a representation of the collection contents could drastically slow debugging for large collections, because the debugger internally calls ToString to display the value. For small collections, this is a huge plus, because you can see the collection contents directly in the debugger. For large collections, though, the returned string is too long to usefully look at, and the debugger might become very slow having to deal with all that data.What I did was use the new &lt;STRONG&gt;DebuggerDisplay&lt;/STRONG&gt; attribute to specify a custom debugger display function. The returned format is similar to how ToString() looks ({1,2,3}), but is limited to around 250 characters. After this, it just puts a &amp;#8220;...&amp;#8220; in the returned string. This gives the advantages of the ToString functionality in debugging, but doesn't negatively impact debugging in large collections. &lt;/P&gt;
&lt;P&gt;2) Several people indicated the desire to customize the look of the returned string, possible by using a different separator than comma, or different string and end character other than braces. To address this, I added an static method to Algorithms: &lt;FONT color=#0000ff size=1&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3&gt;string&lt;/FONT&gt;&lt;/FONT&gt; ToString&amp;lt;T&amp;gt;(IEnumerable&amp;lt;T&amp;gt; collection, &lt;FONT color=#0000ff&gt;bool&lt;/FONT&gt; recursive, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; start, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; separator, &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT size=1&gt;&lt;FONT size=3&gt; end)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This method converts any enumerable collection to a string, and allows complete control over the separator string, as well as the start and end strings. The boolean recursive parameters determines whether contained collections are converted to a string via a recursive call or not.&lt;/P&gt;
&lt;P&gt;Thanks to everyone for their feedback!&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2936" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item><item><title>Feature complete drop</title><link>http://www.wintellect.com/CS/blogs/pgolde/archive/2005/04/08/feature-complete-drop.aspx</link><pubDate>Fri, 08 Apr 2005 06:57:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:2937</guid><dc:creator>pgolde</dc:creator><slash:comments>5</slash:comments><comments>http://www.wintellect.com/CS/blogs/pgolde/comments/2937.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pgolde/commentrss.aspx?PostID=2937</wfw:commentRss><description>&lt;P&gt;Sorry that the project has been so slow the last two months, but it is has not come to a complete stop. There's been some good discussion in the &lt;A href="http://www.wintellect.com/forum/main.asp?CAT_ID=7"&gt;forums&lt;/A&gt;; I'll be working on replying to more of the posts over the next two days.&lt;/P&gt;
&lt;P&gt;Today I've posted a &lt;A href="http://www.wintellect.com/powercollections/download.aspx"&gt;new drop of PowerCollections in the usual place&lt;/A&gt;. You can download the zip to get the source, binaries, and documentation. If you just want to browse documentation, just &lt;A href="http://www.wintellect.com/powercollections/documentation/"&gt;go here&lt;/A&gt;. This drop still uses the November tech preview of Visual C#. Rumor is that Beta 2 of Visual Studio will be released soon; as soon as that is publicly available, I'll be posting a version for Beta 2. &lt;/P&gt;
&lt;P&gt;This version has a two new important classes: MultiDictionary and OrderedMultiDictionary, which map a key to multiple values. I'll post a description of&amp;nbsp;these classes and the design thinking behind them in a subsequent posting. &lt;/P&gt;
&lt;P&gt;This version also has a number of smaller changes:&lt;/P&gt;
&lt;P&gt;1. The BigList class has been updated with many utility methods, to make it much closer to a replacement for the BCL List class.&lt;/P&gt;
&lt;P&gt;2. Most collection classes now have a Comparer property to return the IComparer that the classes was constructed with.&lt;/P&gt;
&lt;P&gt;3. Several renamings of methods to be better: AddAll became AddMany, RemoveAll become RemoveMany, SubsetOf became IsSubsetOf (and several similar renamings), AddTyping became TypedAs, RemoveTyping became Untyped, UniqueItems became DistinctItems.&lt;/P&gt;
&lt;P&gt;4. The Range, RangeFrom, and RangeTo methods on the ordered collections now take additional boolean parameters indicating whether the endpoints of the range should be treated inclusively or exclusively.&lt;/P&gt;
&lt;P&gt;With this drop, Power Collections version 1.0 is feature complete. From now on, I'm not planning to add any new collection types or major new features. Instead, I'm going to polish, fix, and get what is there ready for a final release. In the source, you will we a number of comments marked &amp;#8220;UNDONE&amp;#8221; and &amp;#8220;CONSIDER&amp;#8221;, which list a lot of the items that need to be addressed. I'll also be looking over the comments in the forums one more time to look at suggestions that have been made.&lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=2937" width="1" height="1"&gt;</description><category domain="http://www.wintellect.com/CS/blogs/pgolde/archive/tags/Peter+Golde/default.aspx">Peter Golde</category></item></channel></rss>