MoreEnumerableStartsWithT(IEnumerableT, IEnumerableT, IEqualityComparerT) Method

Determines whether the beginning of the first sequence is equivalent to the second sequence, using the specified element equality comparer.

Definition

Namespace: MoreLinq
Assembly: MoreLinq (in MoreLinq.dll) Version: 4.1.0+0e154ef592f33ce0f6f3d534a9eedee273f0ce72
C#
public static bool StartsWith<T>(
	this IEnumerable<T> first,
	IEnumerable<T> second,
	IEqualityComparer<T>? comparer
)

Parameters

first  IEnumerableT
The sequence to check.
second  IEnumerableT
The sequence to compare to.
comparer  IEqualityComparerT
Equality comparer to use.

Type Parameters

T
Type of elements.

Return Value

Boolean
true if first begins with elements equivalent to second.

Usage Note

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

Remarks

This is the IEnumerableT equivalent of StartsWith(String) and it calls Equals(T, T) on pairs of elements at the same index.

See Also