AlgorithmsSearchForSubsequenceT Method (IListT, IEnumerableT) |
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.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static int SearchForSubsequence<T>(
IList<T> list,
IEnumerable<T> pattern
)
public:
generic<typename T>
static int SearchForSubsequence(
IList<T>^ list,
IEnumerable<T>^ pattern
)
Parameters
- list
- Type: System.Collections.GenericIListT
The list to search. - pattern
- Type: System.Collections.GenericIEnumerableT
The sequence of items to search for.
Type Parameters
- T
- The type of items in the list.
Return Value
Type:
Int32The first index with
list that matches the items in
pattern.
RemarksThe default sense of equality for T is used, as defined by T's
implementation of IComparable<T>.Equals or object.Equals.
See Also