Method Count
Count<T>(ExSpan<T>, T)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ExSpan<T> span, T value) where T : IEquatable<T>?
Parameters
span
ExSpan<T>The span to search.
value
TThe value for which to search.
Returns
- nint
The number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.
Count<T>(ReadOnlyExSpan<T>, T)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ReadOnlyExSpan<T> span, T value) where T : IEquatable<T>?
Parameters
span
ReadOnlyExSpan<T>The span to search.
value
TThe value for which to search.
Returns
- nint
The number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.
Count<T>(ReadOnlyExSpan<T>, T, IEqualityComparer<T>?)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ReadOnlyExSpan<T> span, T value, IEqualityComparer<T>? comparer = null)
Parameters
span
ReadOnlyExSpan<T>The span to search.
value
TThe value for which to search.
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 number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.
Count<T>(ExSpan<T>, ReadOnlyExSpan<T>)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?
Parameters
span
ExSpan<T>The span to search.
value
ReadOnlyExSpan<T>The value for which to search.
Returns
- nint
The number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.
Count<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?
Parameters
span
ReadOnlyExSpan<T>The span to search.
value
ReadOnlyExSpan<T>The value for which to search.
Returns
- nint
The number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.
Count<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)
Counts the number of times the specified value
occurs in the span
.
public static nint Count<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value, IEqualityComparer<T>? comparer = null)
Parameters
span
ReadOnlyExSpan<T>The span to search.
value
ReadOnlyExSpan<T>The value for which to search.
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 number of times
value
was found in thespan
.
Type Parameters
T
The element type of the span.