Click or drag to resize
AlgorithmsBinarySearchT Method (IListT, T, ComparisonT, Int32)
Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed Comparison<T> delegate.

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static int BinarySearch<T>(
	IList<T> list,
	T item,
	Comparison<T> comparison,
	out int index
)

Parameters

list
Type: System.Collections.GenericIListT
The sorted list to search.
item
Type: T
The item to search for.
comparison
Type: SystemComparisonT
The comparison delegate used to sort the list.
index
Type: SystemInt32
Returns the first index at which the item can be found. If the return value is zero, indicating that item was not present in the list, then this returns the index at which item could be inserted to maintain the sorted order of the list.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.BinarySearch``1(System.Collections.Generic.IList{``0},``0,System.Comparison{``0},System.Int32@)"]

Return Value

Type: Int32
The number of items equal to item that appear in the list.
See Also