Method CountAny
CountAny<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>)
Counts the number of times any of the specified values
occurs in the span
.
public static nint CountAny<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> values) where T : IEquatable<T>?
Parameters
span
ReadOnlyExSpan<T>The span to search.
values
ReadOnlyExSpan<T>The set of values for which to search.
Returns
- nint
The number of times any of the
T
elements invalues
was found in thespan
.
Type Parameters
T
The element type of the span.
Remarks
If values
is empty, 0 is returned.
CountAny<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)
Counts the number of times any of the specified values
occurs in the span
.
public static nint CountAny<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> values, IEqualityComparer<T>? comparer = null)
Parameters
span
ReadOnlyExSpan<T>The span to search.
values
ReadOnlyExSpan<T>The set of values 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 any of the
T
elements invalues
was found in thespan
.
Type Parameters
T
The element type of the span.
Remarks
If values
is empty, 0 is returned.