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(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 9 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.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 9 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.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 9
Product Versions
.NET 9

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#
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.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1