- bits & pieces about software development HostingAbc Logo
Show all posts.
How to do a simple sorted list in C# ? Here it is:

C#
1
2
3
4
5
6
7
8
class MySortedList<T> : List<T>
{
    new public void Add(T item)
    {
        int index = BinarySearch(item);
        Insert(index >= 0 ? index : ~index, item);
    }
}

(andrás & moszi coop)
1) Define the original issue.
2) The sorted list is sorted on value and there is not a key!
3) dark green text with black background: not too easy to read.
wrote byapco9/30/2007 9:07 AMm@ail
add linkThe last comments:lucifer says:oh, i see now :D lucifer says:"If the LINQ runtime just thrown an exception similar to this one to your face". which one? :)apco says:1) Define the original issue. 2) The sorted list is sorted on value and there is not a key! 3) dark green text with black background: not too easy to read.moszidev says:Actually I've made these 2 forms with Expression Blend. I'm not sure if the extensive designing capabilities will be included in the VS designer ...Venemo says:I've just tried out Visual Studio 2008 Express, and it doesn't have the functionality to rotate the controls, but when I copied your source code, it recognised it. Anyway, it seems very similar to VS 2005, and only has a few improvements in its interBéla says:At long last! I'm looking forward to it! Keep it up! and so on ;)
Copyright (C) 2007, Molnar Szilveszter m@il me