MemoryExtensions.CommonPrefixLength Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CommonPrefixLength<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Finds the length of any common prefix shared between |
CommonPrefixLength<T>(Span<T>, ReadOnlySpan<T>) |
Finds the length of any common prefix shared between |
CommonPrefixLength<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>) |
Determines the length of any common prefix shared between |
CommonPrefixLength<T>(Span<T>, ReadOnlySpan<T>, IEqualityComparer<T>) |
Finds the length of any common prefix shared between |
CommonPrefixLength<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Finds the length of any common prefix shared between span
and other
.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int CommonPrefixLength(ReadOnlySpan<T> span, ReadOnlySpan<T> other);
public static int CommonPrefixLength<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> other);
static member CommonPrefixLength : ReadOnlySpan<'T> * ReadOnlySpan<'T> -> int
<Extension()>
Public Function CommonPrefixLength(Of T) (span As ReadOnlySpan(Of T), other As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The type of the elements in the spans.
Parameters
- span
- ReadOnlySpan<T>
The first sequence to compare.
- other
- ReadOnlySpan<T>
The second sequence to compare.
Returns
The length of the common prefix shared by the two spans. If there's no shared prefix, 0 is returned.
Applies to
CommonPrefixLength<T>(Span<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Finds the length of any common prefix shared between span
and other
.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int CommonPrefixLength(Span<T> span, ReadOnlySpan<T> other);
public static int CommonPrefixLength<T> (this Span<T> span, ReadOnlySpan<T> other);
static member CommonPrefixLength : Span<'T> * ReadOnlySpan<'T> -> int
<Extension()>
Public Function CommonPrefixLength(Of T) (span As Span(Of T), other As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The type of the elements in the spans.
Parameters
- span
- Span<T>
The first sequence to compare.
- other
- ReadOnlySpan<T>
The second sequence to compare.
Returns
The length of the common prefix shared by the two spans. If there's no shared prefix, 0 is returned.
Applies to
CommonPrefixLength<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Determines the length of any common prefix shared between span
and other
.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int CommonPrefixLength(ReadOnlySpan<T> span, ReadOnlySpan<T> other, System::Collections::Generic::IEqualityComparer<T> ^ comparer);
public static int CommonPrefixLength<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> other, System.Collections.Generic.IEqualityComparer<T>? comparer);
static member CommonPrefixLength : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function CommonPrefixLength(Of T) (span As ReadOnlySpan(Of T), other As ReadOnlySpan(Of T), comparer As IEqualityComparer(Of T)) As Integer
Type Parameters
- T
The type of the elements in the sequences.
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
The length of the common prefix shared by the two spans. If there's no shared prefix, 0 is returned.
Applies to
CommonPrefixLength<T>(Span<T>, ReadOnlySpan<T>, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Finds the length of any common prefix shared between span
and other
.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int CommonPrefixLength(Span<T> span, ReadOnlySpan<T> other, System::Collections::Generic::IEqualityComparer<T> ^ comparer);
public static int CommonPrefixLength<T> (this Span<T> span, ReadOnlySpan<T> other, System.Collections.Generic.IEqualityComparer<T>? comparer);
static member CommonPrefixLength : Span<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function CommonPrefixLength(Of T) (span As Span(Of T), other As ReadOnlySpan(Of T), comparer As IEqualityComparer(Of T)) As Integer
Type Parameters
- T
The type of the elements in the spans.
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
The length of the common prefix shared by the two spans. If there's no shared prefix, 0 is returned.