Edit

Share via


ReadOnlySpanExtensions.Count<T>(ReadOnlySpan<T>, T) Method

Definition

Counts the number of occurrences of a given value into a target ReadOnlySpan<T> instance.

public static int Count<T> (this ReadOnlySpan<T> span, T value) where T : IEquatable<T>;
static member Count : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Count(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As T) As Integer

Type Parameters

T

The type of items in the input ReadOnlySpan<T> instance.

Parameters

span
ReadOnlySpan<T>

The input ReadOnlySpan<T> instance to read.

value
T

The T value to look for.

Returns

The number of occurrences of value in span.

Applies to