Прочетете на английски Редактиране

Споделяне чрез


MemoryExtensions.EndsWith Method

Definition

Overloads

EndsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

Determines whether the end of the span matches the specified value when compared using the specified comparisonType option.

EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Determines whether the specified sequence appears at the end of a read-only span.

EndsWith<T>(ReadOnlySpan<T>, T)

Determines whether the specified value appears at the end of the span.

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

Determines whether the specified sequence appears at the end of a span.

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

EndsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

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

Determines whether the end of the span matches the specified value when compared using the specified comparisonType option.

C#
public static bool EndsWith(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);

Parameters

span
ReadOnlySpan<Char>

The source span.

value
ReadOnlySpan<Char>

The sequence to compare to the end of the source span.

comparisonType
StringComparison

An enumeration value that determines how span and value are compared.

Returns

true if value matches the end of span; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

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

Determines whether the specified sequence appears at the end of a read-only span.

C#
public static bool EndsWith<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;

Type Parameters

T

The type of the span.

Parameters

span
ReadOnlySpan<T>

The source span.

value
ReadOnlySpan<T>

The sequence to compare to the end of the source span.

Returns

true if value matches the end of span; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

EndsWith<T>(ReadOnlySpan<T>, T)

Determines whether the specified value appears at the end of the span.

C#
public static bool EndsWith<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>;

Type Parameters

T

The type of elements in the span.

Parameters

span
ReadOnlySpan<T>

The span to search.

value
T

The value to compare.

Returns

true if value matches the end of span; otherwise, false.

Applies to

.NET 10 и .NET 9
Продукт Версии
.NET 9, 10

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

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

Determines whether the specified sequence appears at the end of a span.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static bool EndsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
C#
public static bool EndsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;

Type Parameters

T

The type of the span.

Parameters

span
Span<T>

The source span.

value
ReadOnlySpan<T>

The sequence to compare to the end of the source span.

Returns

true if value matches the end of span; otherwise, false.

Attributes

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

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

C#
public static bool EndsWith<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);

Type Parameters

T

Parameters

Returns

Applies to

.NET 10
Продукт Версии
.NET 10

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

C#
public static bool EndsWith<T>(this ReadOnlySpan<T> span, T value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);

Type Parameters

T

Parameters

value
T

Returns

Applies to

.NET 10
Продукт Версии
.NET 10