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
spanReadOnlyExSpan<T>The span to search.
valuesReadOnlyExSpan<T>The set of values for which to search.
Returns
- nint
The number of times any of the
Telements invalueswas found in thespan.
Type Parameters
TThe 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
spanReadOnlyExSpan<T>The span to search.
valuesReadOnlyExSpan<T>The set of values for which to search.
comparerIEqualityComparer<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
Telements invalueswas found in thespan.
Type Parameters
TThe element type of the span.
Remarks
If values is empty, 0 is returned.