MemoryExtensions.Count 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
| Count<T>(ReadOnlySpan<T>, T, IEqualityComparer<T>) |
Counts the number of times the specified |
| Count<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>) |
Counts the number of times the specified |
| Count<T>(Span<T>, T) |
Counts the number of times the specified |
| Count<T>(ReadOnlySpan<T>, T) |
Counts the number of times the specified |
| Count<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Counts the number of times |
| Count<T>(Span<T>, ReadOnlySpan<T>) |
Counts the number of times the specified |
Count<T>(ReadOnlySpan<T>, T, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
Counts the number of times the specified value occurs in the span.
public static int Count<T>(this ReadOnlySpan<T> span, T value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member Count : ReadOnlySpan<'T> * 'T * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function Count(Of T) (span As ReadOnlySpan(Of T), value As 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.
- value
- T
The value to search for.
- 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 value was found in the span.
Applies to
Count<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
Counts the number of times the specified value occurs in the span.
public static int Count<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member Count : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function Count(Of T) (span As ReadOnlySpan(Of T), value 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.
- value
- ReadOnlySpan<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
The number of times value was found in the span.
Applies to
Count<T>(Span<T>, T)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Counts the number of times the specified value occurs in the span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int Count(Span<T> span, T value);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int Count<T>(this Span<T> span, T value) where T : IEquatable<T>;
public static int Count<T>(this Span<T> span, T value) where T : IEquatable<T>;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member Count : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires 'T :> IEquatable<'T>)
static member Count : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Count(Of T As IEquatable(Of T)) (span As Span(Of T), value As T) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- Span<T>
The span to search.
- value
- T
The value for which to search.
Returns
The number of times value was found in the span.
- Attributes
Applies to
Count<T>(ReadOnlySpan<T>, T)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Counts the number of times the specified value occurs in the span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int Count(ReadOnlySpan<T> span, T value);
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 element type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value
- T
The value for which to search.
Returns
The number of times value was found in the span.
Applies to
Count<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Counts the number of times value occurs in span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int Count(ReadOnlySpan<T> span, ReadOnlySpan<T> value);
public static int Count<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member Count : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Count(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value
- ReadOnlySpan<T>
The value for which to search.
Returns
The number of times value was found in span.
Applies to
Count<T>(Span<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Counts the number of times the specified value occurs in the span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int Count(Span<T> span, ReadOnlySpan<T> value);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int Count<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
public static int Count<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member Count : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
static member Count : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Count(Of T As IEquatable(Of T)) (span As Span(Of T), value As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The element type of the span.
Parameters
- span
- Span<T>
The span to search.
- value
- ReadOnlySpan<T>
The value for which to search.
Returns
The number of times value was found in the span.
- Attributes