MemoryExtensions.CountAny 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
| CountAny<T>(ReadOnlySpan<T>, SearchValues<T>) |
Counts the number of times any of the specified |
| CountAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Counts the number of times any of the specified |
| CountAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>) |
Counts the number of times any of the specified |
CountAny<T>(ReadOnlySpan<T>, SearchValues<T>)
- Source:
- MemoryExtensions.cs
Counts the number of times any of the specified values occurs in the span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int CountAny(ReadOnlySpan<T> span, System::Buffers::SearchValues<T> ^ values);
public static int CountAny<T>(this ReadOnlySpan<T> span, System.Buffers.SearchValues<T> values) where T : IEquatable<T>;
static member CountAny : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * System.Buffers.SearchValues<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function CountAny(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), values As SearchValues(Of T)) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- values
- SearchValues<T>
The set of values for which to search.
Returns
The number of times any of the T elements in values was found in the span.
Exceptions
values is null.
Remarks
If values is empty, 0 is returned.
Applies to
CountAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
Counts the number of times any of the specified values occurs in the span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int CountAny(ReadOnlySpan<T> span, ReadOnlySpan<T> values);
public static int CountAny<T>(this ReadOnlySpan<T> span, scoped ReadOnlySpan<T> values) where T : IEquatable<T>;
static member CountAny : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function CountAny(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), values As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- values
- ReadOnlySpan<T>
The set of values for which to search.
Returns
The number of times any of the T elements in values was found in the span.
Remarks
If values is empty, 0 is returned.
Applies to
CountAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
Counts the number of times any of the specified values occurs in the span.
public static int CountAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member CountAny : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function CountAny(Of T) (span As ReadOnlySpan(Of T), values As ReadOnlySpan(Of T), Optional comparer As IEqualityComparer(Of T) = Nothing) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- values
- ReadOnlySpan<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
The number of times any of the T elements in values was found in the span.
Remarks
If values is empty, 0 is returned.