MemoryExtensions.SequenceCompareTo MemoryExtensions.SequenceCompareTo MemoryExtensions.SequenceCompareTo MemoryExtensions.SequenceCompareTo Method

定义

重载

SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

通过使用 IComparable{T}.CompareTo(T) 比较它们的元素,确定两个只读序列的相对顺序。Determines the relative order of two read-only sequences by comparing their elements using IComparable{T}.CompareTo(T).

SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>)

通过使用 IComparable{T}.CompareTo(T) 比较它们的元素,确定跨度和只读跨度的相对顺序。Determines the relative order of a span and a read-only span by comparing the elements using IComparable{T}.CompareTo(T).

SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

通过使用 IComparable{T}.CompareTo(T) 比较它们的元素,确定两个只读序列的相对顺序。Determines the relative order of two read-only sequences by comparing their elements using IComparable{T}.CompareTo(T).

public:
generic <typename T>
 where T : IComparable<T>[System::Runtime::CompilerServices::Extension]
 static int SequenceCompareTo(ReadOnlySpan<T> span, ReadOnlySpan<T> other);
public static int SequenceCompareTo<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> other) where T : IComparable<T>;
static member SequenceCompareTo : ReadOnlySpan<'T (requires 'T :> IComparable<'T>)> * ReadOnlySpan<'T (requires 'T :> IComparable<'T>)> -> int (requires 'T :> IComparable<'T>)
<Extension()>
Public Function SequenceCompareTo(Of T As IComparable(Of T)) (span As ReadOnlySpan(Of T), other As ReadOnlySpan(Of T)) As Integer

类型参数

T

序列中的元素的类型。The type of elements in the sequence.

参数

span
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要比较的第一个序列。The first sequence to compare.

other
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要比较的第二个序列。The second sequence to compare.

返回

一个带符号整数,表示 spanother 的相对顺序:A signed integer that indicates the relative order of span and other:
- 如果小于 0,则 spanother 之前。- If less than 0, span precedes than other.
- 如果为 0,则 span 等于 other- If 0, span equals other.
- 如果大于 0,则 spanother 之后。- If greater than 0, span follows other.

SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>)

通过使用 IComparable{T}.CompareTo(T) 比较它们的元素,确定跨度和只读跨度的相对顺序。Determines the relative order of a span and a read-only span by comparing the elements using IComparable{T}.CompareTo(T).

public:
generic <typename T>
 where T : IComparable<T>[System::Runtime::CompilerServices::Extension]
 static int SequenceCompareTo(Span<T> span, ReadOnlySpan<T> other);
public static int SequenceCompareTo<T> (this Span<T> span, ReadOnlySpan<T> other) where T : IComparable<T>;
static member SequenceCompareTo : Span<'T (requires 'T :> IComparable<'T>)> * ReadOnlySpan<'T (requires 'T :> IComparable<'T>)> -> int (requires 'T :> IComparable<'T>)
<Extension()>
Public Function SequenceCompareTo(Of T As IComparable(Of T)) (span As Span(Of T), other As ReadOnlySpan(Of T)) As Integer

类型参数

T

范围中元素的类型。The type of elements in the span.

参数

span
Span<T> Span<T> Span<T> Span<T>

要比较的跨度。The span to compare.

other
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要比较的只读跨度。The read-only span to compare.

返回

一个带符号整数,表示 spanother 的相对顺序:A signed integer that indicates the relative order of span and other:
- 如果小于 0,则 spanother 之前。- If less than 0, span precedes than other.
- 如果为 0,则 span 等于 other- If 0, span equals other.
- 如果大于 0,则 spanother 之后。- If greater than 0, span follows other.

适用于