แก้ไข

แชร์ผ่าน


MemoryExtensions.SequenceEqual Method

Definition

Overloads

SequenceEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Determines whether two read-only sequences are equal by comparing the elements using IEquatable{T}.Equals(T).

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

Determines whether a span and a read-only span are equal by comparing the elements using IEquatable{T}.Equals(T).

SequenceEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)

Determines whether two sequences are equal by comparing the elements using an IEqualityComparer<T>.

SequenceEqual<T>(Span<T>, ReadOnlySpan<T>, IEqualityComparer<T>)

Determines whether two sequences are equal by comparing the elements using an IEqualityComparer<T>.

SequenceEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether two read-only sequences are equal by comparing the elements using IEquatable{T}.Equals(T).

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

Type Parameters

T

The type of elements in the sequence.

Parameters

span
ReadOnlySpan<T>

The first sequence to compare.

other
ReadOnlySpan<T>

The second sequence to compare.

Returns

true if the two sequences are equal; otherwise, false.

Applies to

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

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether a span and a read-only span are equal by comparing the elements using IEquatable{T}.Equals(T).

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

Type Parameters

T

The type of elements in the sequence.

Parameters

span
Span<T>

The span to compare.

other
ReadOnlySpan<T>

The read-only span to compare.

Returns

true if the two sequences are equal; otherwise, false.

Applies to

SequenceEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether two sequences are equal by comparing the elements using an IEqualityComparer<T>.

public static bool SequenceEqual<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> other, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member SequenceEqual : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> bool
<Extension()>
Public Function SequenceEqual(Of T) (span As ReadOnlySpan(Of T), other As ReadOnlySpan(Of T), Optional comparer As IEqualityComparer(Of T) = Nothing) As Boolean

Type Parameters

T

The type of elements in the sequence.

Parameters

span
ReadOnlySpan<T>

The first sequence to compare.

other
ReadOnlySpan<T>

The second sequence to compare.

comparer
IEqualityComparer<T>

The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.

Returns

true if the two sequences are equal; otherwise, false.

Applies to

SequenceEqual<T>(Span<T>, ReadOnlySpan<T>, IEqualityComparer<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether two sequences are equal by comparing the elements using an IEqualityComparer<T>.

public static bool SequenceEqual<T> (this Span<T> span, ReadOnlySpan<T> other, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member SequenceEqual : Span<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> bool
<Extension()>
Public Function SequenceEqual(Of T) (span As Span(Of T), other As ReadOnlySpan(Of T), Optional comparer As IEqualityComparer(Of T) = Nothing) As Boolean

Type Parameters

T

The type of elements in the sequence.

Parameters

span
Span<T>

The first sequence to compare.

other
ReadOnlySpan<T>

The second sequence to compare.

comparer
IEqualityComparer<T>

The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.

Returns

true if the two sequences are equal; otherwise, false.

Applies to