Dear ladies and sirs.
Is there a library of generic collection algorithms for .NET? I would like to be able to write something like this:
IList<T> items = GetItemsFromSomeWhere();
Algorithms<T>.Sort(items);
//
// bla bla bla
//
T item = GetItemSomwHow();
int i = Algorithms<T>.IndexOf(items, item);
Note, that items
is not List<T>
, otherwise I could simply use the List<T>.Sort
and List<T>.BinarySearch
methods.
Of course, I can implement them myself, I just do not want to invent a wheel.
Ah, and another thing. I would like the implementation to be efficient.
Thanks.
P.S.
Please, do not advise on which collections to use. I am perfectly aware of the Array
or List<T>
abilities. What I need is a library of algorithms to work on any IList<T>
based collection.
EDIT: Found what I needed - see my own answer.