Click or drag to resize

binarySearchBinarySearchT Method (IListT, T, IComparerT)

Namespace:  WhetStone.Looping
Assembly:  WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
C#
public static int BinarySearch<T>(
	this IList<T> this,
	T tofind,
	IComparer<T> comp = null
)

Parameters

this
Type: System.Collections.GenericIListT
The sorted IListT to perform the search on.
tofind
Type: T
The element to search for.
comp (Optional)
Type: System.Collections.GenericIComparerT
The comparer by which this is sorted. If set to null, the default comparer will be used.

Type Parameters

T
The type of the IListT.

Return Value

Type: Int32
The index of tofind in this, or -1 if tofind is not in this.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IListT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also