Extensions.CompareArray<TElement> Method

Definition

Compares two equal-length sequences of integers by perform an element-wise comparison, starting from the first element.

public static int CompareArray<TElement> (System.Collections.Generic.IEnumerable<TElement> xArr, System.Collections.Generic.IEnumerable<TElement> yArr, System.Collections.Generic.IComparer<TElement> comparer = default);
static member CompareArray : seq<'Element> * seq<'Element> * System.Collections.Generic.IComparer<'Element> -> int
Public Function CompareArray(Of TElement) (xArr As IEnumerable(Of TElement), yArr As IEnumerable(Of TElement), Optional comparer As IComparer(Of TElement) = Nothing) As Integer

Type Parameters

TElement

Parameters

xArr
IEnumerable<TElement>

First sequence of elements.

yArr
IEnumerable<TElement>

Second sequence of elements.

comparer
IComparer<TElement>

Comparer used to define ordering of elements.

Returns

Int32

Returns 1 if xArr is greater than yArr. Returns -1 if xArr is less than yArr. Returns 0 if xArr is equal to yArr.

Examples

CompareIntArray(new Int64[] {5}, new Int64[] {7}) == -1; CompareIntArray(new Int64[] {5,7}, new Int64[] {5,6}) == 1; CompareIntArray(new Int64[] {2,1,3}, new Int64[] {2,2,3}) == -1;

Applies to