public int BinarySearch( T item );
public int BinarySearch( T item, IComparer<T> comparer );
public int BinarySearch( int index, int count, T item, IComparer<T> comparer );
The C5 collections library (see http://www.itu.dk/research/c5/) includes TreeDictionary<> classes with balanced red-black binary trees. Note: I have not used this library yet, as the work I do needs nothing more that the standard .NET collections.
// Created sorted set of strings.
var set = new SortedSet<string>();
// Add three elements.
set.Add("net");
set.Add("net"); // Duplicate elements are ignored.
set.Add("dot");
set.Add("rehan");
// Remove an element.
set.Remove("rehan");
// Print elements in set.
foreach (var value in set)
{
Console.WriteLine(value);
}
// Output is in alphabetical order:
// dot
// net