Click or drag to resize
AlgorithmsSearchForSubsequenceT Method (IListT, IEnumerableT, BinaryPredicateT)
Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is "equal" to the first item in pattern, list[i+1] is "equal" to the second item in pattern, and so forth for all the items in pattern. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static int SearchForSubsequence<T>(
	IList<T> list,
	IEnumerable<T> pattern,
	BinaryPredicate<T> predicate
)

Parameters

list
Type: System.Collections.GenericIListT
The list to search.
pattern
Type: System.Collections.GenericIEnumerableT
The sequence of items to search for.
predicate
Type: X3Platform.CollectionsBinaryPredicateT
The BinaryPredicate used to compare items for "equality".

Type Parameters

T
The type of items in the list.

Return Value

Type: Int32
The first index with list that matches the items in pattern.
Remarks
Since an arbitrary BinaryPredicate is passed to this function, what is being tested for in the pattern need not be equality.
See Also