Click or drag to resize

CollectionExtensionsBinarySearchTCollection, TElement Method (ICollectionTCollection, TElement, FuncTCollection, TElement, Int32, Int32)

Find an element in a collection by binary searching. This requires the collection to be sorted on the values returned by getSubElement This will compare some derived property of the elements in the collection, rather than the elements themselves.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static int BinarySearch<TCollection, TElement>(
	this ICollection<TCollection> source,
	TElement value,
	Func<TCollection, TElement> getSubElement,
	int index,
	int length
)

Parameters

source
Type: System.Collections.GenericICollectionTCollection
value
Type: TElement
getSubElement
Type: SystemFuncTCollection, TElement
index
Type: SystemInt32
length
Type: SystemInt32

Type Parameters

TCollection
TElement

Return Value

Type: Int32

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ICollectionTCollection. 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