﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Daniel Schilling commented on What is wrong with SortedList&lt;T&gt;</title><description>Also, add the comparer to the interface:
  
  
public interface ISortedList&lt;TKey, TValue&gt;
  
: IDictionary&lt;TKey, TValue&gt;, IList&lt;TValue&gt;
  
{
  
IList&lt;TKey&gt; Keys { get; }
  
IComparer&lt;TKey&gt; Comparer { get; }
  
}
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment8</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment8</guid><pubDate>Wed, 13 Aug 2008 12:51:49 GMT</pubDate></item><item><title>Daniel Schilling commented on What is wrong with SortedList&lt;T&gt;</title><description>I'm annoyed that SortedList doesn't implement an interface that describes it's special abilities.  I'm thinking something along the lines of:
  
  
public interface ISortedList&lt;TKey, TValue&gt;
  
    : IDictionary&lt;TKey, TValue&gt;, IList&lt;TValue&gt;
  
{
  
    IList&lt;TKey&gt; Keys { get; }
  
}
  
  
The IList&lt;&gt; interface would act in a readonly fashion, throwing NotSupportedException.  Any weirdness introduced by the possibility of a SortedList whose keys are ints could be solved as follows:
  
  
public class SortedList&lt;TKey, TValue&gt;
  
    : ISortedList&lt;TKey, TValue&gt;
  
{
  
    ....
  
    public TValue this[TKey key]
  
    {
  
        get { ... }
  
        set { ... }
  
    }
  
  
    TValue IList&lt;TValue&gt;.this[int index]
  
    {
  
        get { ... }
  
        set { ... }
  
    }
  
    ....
  
}
  
  
Having SortedList implement an interface like this would give me a lot more control over some of the NHibernate user types I create without having to do hackish things in my domain objects like accessing PersistentGenericMap.Entries().
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment7</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment7</guid><pubDate>Wed, 13 Aug 2008 12:26:35 GMT</pubDate></item><item><title>Jon Skeet commented on What is wrong with SortedList&lt;T&gt;</title><description>My problem with "SortedList" is that the "list" part is an implementation detail for what is mostly a dictionary in terms of API. I would have preferred them to name it "ListDictionary" with "SortedDictionary" called "TreeDictionary". (Either of those could be prefixed with "Sorted" if desired.)
  
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment6</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment6</guid><pubDate>Mon, 11 Aug 2008 09:34:07 GMT</pubDate></item><item><title>Patrik H&amp;#228;gne commented on What is wrong with SortedList&lt;T&gt;</title><description>If there was actually an indexer that took an int for the index it should return a KeyValuePair&lt;TKey, TValue&gt; rather than a TValue, so that wouldn't really solve the problem any more elegantly than using the values collection. I guess the solution would be two methods, GetValueAt(int index) and GetKeyAt(int index) but I'm not sure it adds anything but pollution. I believe that the "law" of demeter is something that you should take a very pragmatic approach to rather than regarding it as a law.
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment5</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment5</guid><pubDate>Mon, 11 Aug 2008 07:43:36 GMT</pubDate></item><item><title>Frederik Gheysels commented on What is wrong with SortedList&lt;T&gt;</title><description>I was pretty sure that the non-generic SortedList did have a method which retrieves the value at a specific index (I used it a few days ago).
  
So, I checked it right now, and indeed:
  
The non-generic sortedList has a method 'GetByIndex', whereas the generic SortedList indeed doesn't have this functionality.
  
  
Why would they (MS) have discarded it ?
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment4</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment4</guid><pubDate>Sat, 09 Aug 2008 08:26:34 GMT</pubDate></item><item><title>Bryan commented on What is wrong with SortedList&lt;T&gt;</title><description>Maybe not an indexer, but why not a GetAt(int) method?  I don't have VS fired up right now, so I don't know what methods are or aren't there, but having one seems reasonable.
  
  
Anyway, what really want to know is why there's no pre-canned method for copying the output of one stream to the input of another stream.  It's 2008 for God's sake.  Let's get a InputStream.CopyTo(OutpuStream) method already.
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment3</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment3</guid><pubDate>Sat, 09 Aug 2008 05:25:36 GMT</pubDate></item><item><title>Rob commented on What is wrong with SortedList&lt;T&gt;</title><description>You couldn't have an int indexer, because someone might want to use integers as keys. Wouldnt adding a "ValueAt(int i)" method just be pollution?
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment2</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment2</guid><pubDate>Sat, 09 Aug 2008 02:23:24 GMT</pubDate></item><item><title>Lucas Goodwin commented on What is wrong with SortedList&lt;T&gt;</title><description>I would go so far as to say SortList shouldn't even have integer methods if you are going to use keys for indexing.  The parrellel contexts can be... problematic.
</description><link>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment1</link><guid>http://ayende.com/3500/what-is-wrong-with-sortedlist-t#comment1</guid><pubDate>Fri, 08 Aug 2008 22:07:05 GMT</pubDate></item></channel></rss>