Table of Contents

Method CommonPrefixLength

Namespace
Zyl.ExSpans
Assembly
ExSpans.dll

CommonPrefixLength<T>(ExSpan<T>, ReadOnlyExSpan<T>)

Finds the length of any common prefix shared between span and other.

public static nint CommonPrefixLength<T>(this ExSpan<T> span, ReadOnlyExSpan<T> other)

Parameters

span ExSpan<T>

The first sequence to compare.

other ReadOnlyExSpan<T>

The second sequence to compare.

Returns

nint

The length of the common prefix shared by the two ExSpans. If there's no shared prefix, 0 is returned.

Type Parameters

T

The type of the elements in the spans.

CommonPrefixLength<T>(ExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)

Finds the length of any common prefix shared between span and other.

public static nint CommonPrefixLength<T>(this ExSpan<T> span, ReadOnlyExSpan<T> other, IEqualityComparer<T>? comparer)

Parameters

span ExSpan<T>

The first sequence to compare.

other ReadOnlyExSpan<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

nint

The length of the common prefix shared by the two ExSpans. If there's no shared prefix, 0 is returned.

Type Parameters

T

The type of the elements in the spans.

CommonPrefixLength<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>)

Finds the length of any common prefix shared between span and other.

public static nint CommonPrefixLength<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> other)

Parameters

span ReadOnlyExSpan<T>

The first sequence to compare.

other ReadOnlyExSpan<T>

The second sequence to compare.

Returns

nint

The length of the common prefix shared by the two ExSpans. If there's no shared prefix, 0 is returned.

Type Parameters

T

The type of the elements in the spans.

CommonPrefixLength<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)

Determines the length of any common prefix shared between span and other.

public static nint CommonPrefixLength<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> other, IEqualityComparer<T>? comparer)

Parameters

span ReadOnlyExSpan<T>

The first sequence to compare.

other ReadOnlyExSpan<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

nint

The length of the common prefix shared by the two ExSpans. If there's no shared prefix, 0 is returned.

Type Parameters

T

The type of the elements in the sequences.