MemoryExtensions.Contains 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
| Contains(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Indicates whether a specified value occurs within a read-only character span. |
| Contains<T>(ReadOnlySpan<T>, T) |
Indicates whether a specified value is found in a read-only span. |
| Contains<T>(Span<T>, T) |
Indicates whether a specified value is found in a span. |
| Contains<T>(ReadOnlySpan<T>, T, IEqualityComparer<T>) |
Searches for the specified value and returns |
Contains(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)
Indicates whether a specified value occurs within a read-only character span.
public:
[System::Runtime::CompilerServices::Extension]
static bool Contains(ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
public static bool Contains(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
static member Contains : ReadOnlySpan<char> * ReadOnlySpan<char> * StringComparison -> bool
<Extension()>
Public Function Contains (span As ReadOnlySpan(Of Char), value As ReadOnlySpan(Of Char), comparisonType As StringComparison) As Boolean
Parameters
- span
- ReadOnlySpan<Char>
The source span.
- value
- ReadOnlySpan<Char>
The value to seek within the source span.
- comparisonType
- StringComparison
An enumeration value that determines how the characters in span and value are compared.
Returns
true if value occurs within the span, false otherwise.
Applies to
Contains<T>(ReadOnlySpan<T>, T)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Indicates whether a specified value is found in a read-only span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static bool Contains(ReadOnlySpan<T> span, T value);
public static bool Contains<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>;
static member Contains : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Contains(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As T) As Boolean
Type Parameters
- T
The type of the span.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value
- T
The value to search for.
Returns
true if found, false otherwise.
Remarks
Values are compared using IEquatable{T}.Equals(T).
Applies to
Contains<T>(Span<T>, T)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Indicates whether a specified value is found in a span.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static bool Contains(Span<T> span, T value);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static bool Contains<T>(this Span<T> span, T value) where T : IEquatable<T>;
public static bool Contains<T>(this Span<T> span, T value) where T : IEquatable<T>;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member Contains : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> bool (requires 'T :> IEquatable<'T>)
static member Contains : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Contains(Of T As IEquatable(Of T)) (span As Span(Of T), value As T) As Boolean
Type Parameters
- T
The type of the elements in the span.
Parameters
- span
- Span<T>
The span to search.
- value
- T
The value to search for.
Returns
true if found, false otherwise.
- Attributes
Remarks
Values are compared using IEquatable{T}.Equals(T).
Applies to
Contains<T>(ReadOnlySpan<T>, T, IEqualityComparer<T>)
- Source:
- MemoryExtensions.cs
Searches for the specified value and returns true if found. If not found, returns false.
public static bool Contains<T>(this ReadOnlySpan<T> span, T value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member Contains : ReadOnlySpan<'T> * 'T * System.Collections.Generic.IEqualityComparer<'T> -> bool
<Extension()>
Public Function Contains(Of T) (span As ReadOnlySpan(Of T), value As T, Optional comparer As IEqualityComparer(Of T) = Nothing) As Boolean
Type Parameters
- T
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.