MemoryExtensions.BinarySearch Method (System) (original) (raw)
- Reference
Definition
Overloads
BinarySearch<T,TComparable>(Span, TComparable) | Searches an entire sorted Span for a value using the specified TComparable generic type. |
---|---|
BinarySearch<T,TComparable>(ReadOnlySpan, TComparable) | Searches an entire sorted ReadOnlySpan for a value using the specified TComparable generic type. |
BinarySearch<T,TComparer>(ReadOnlySpan, T, TComparer) | Searches an entire sorted ReadOnlySpan for a specified value using the specified TComparer generic type. |
BinarySearch<T,TComparer>(Span, T, TComparer) | Searches an entire sorted Span for a specified value using the specified TComparer generic type. |
BinarySearch(ReadOnlySpan, IComparable) | Searches an entire sorted ReadOnlySpan for a value using the specified IComparable generic interface. |
BinarySearch(Span, IComparable) | Searches an entire sorted Span for a value using the specified IComparable generic interface. |
BinarySearch<T,TComparable>(Span, TComparable)
Source:
Source:
Source:
Source:
Searches an entire sorted Span for a value using the specified TComparable
generic type.
public:
generic <typename T, typename TComparable>
where TComparable : IComparable<T>[System::Runtime::CompilerServices::Extension]
static int BinarySearch(Span<T> span, TComparable comparable);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int BinarySearch<T,TComparable>(this Span<T> span, TComparable comparable) where TComparable : IComparable<T>, allows ref struct;
public static int BinarySearch<T,TComparable>(this Span<T> span, TComparable comparable) where TComparable : IComparable<T>;
public static int BinarySearch<T,TComparable>(this Span<T> span, TComparable comparable) where TComparable : IComparable<T>, allows ref struct;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member BinarySearch : Span<'T> * 'Comparable -> int (requires 'Comparable :> IComparable<'T>)
static member BinarySearch : Span<'T> * 'Comparable -> int (requires 'Comparable :> IComparable<'T>)
<Extension()>
Public Function BinarySearch(Of T, TComparable) (span As Span(Of T), comparable As TComparable) As Integer
Type Parameters
T
The element type of the span.
Parameters
comparable
TComparable
The TComparable
to use when comparing.
Returns
The zero-based index of comparable
in the sorted span
, if comparable
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than comparable
or, if there is no larger element, the bitwise complement of Length.
Attributes
Exceptions
Applies to
BinarySearch<T,TComparable>(ReadOnlySpan, TComparable)
Source:
Source:
Source:
Source:
Searches an entire sorted ReadOnlySpan for a value using the specified TComparable
generic type.
public:
generic <typename T, typename TComparable>
where TComparable : IComparable<T>[System::Runtime::CompilerServices::Extension]
static int BinarySearch(ReadOnlySpan<T> span, TComparable comparable);
public static int BinarySearch<T,TComparable>(this ReadOnlySpan<T> span, TComparable comparable) where TComparable : IComparable<T>, allows ref struct;
public static int BinarySearch<T,TComparable>(this ReadOnlySpan<T> span, TComparable comparable) where TComparable : IComparable<T>;
static member BinarySearch : ReadOnlySpan<'T> * 'Comparable -> int (requires 'Comparable :> IComparable<'T>)
<Extension()>
Public Function BinarySearch(Of T, TComparable) (span As ReadOnlySpan(Of T), comparable As TComparable) As Integer
Type Parameters
T
The element type of the span.
Parameters
comparable
TComparable
The TComparable
to use when comparing.
Returns
The zero-based index of comparable
in the sorted span
, if comparable
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than comparable
or, if there is no larger element, the bitwise complement of Length.
Exceptions
Applies to
BinarySearch<T,TComparer>(ReadOnlySpan, T, TComparer)
Source:
Source:
Source:
Source:
Searches an entire sorted ReadOnlySpan for a specified value using the specified TComparer
generic type.
public:
generic <typename T, typename TComparer>
where TComparer : System::Collections::Generic::IComparer<T>[System::Runtime::CompilerServices::Extension]
static int BinarySearch(ReadOnlySpan<T> span, T value, TComparer comparer);
public static int BinarySearch<T,TComparer>(this ReadOnlySpan<T> span, T value, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>, allows ref struct;
public static int BinarySearch<T,TComparer>(this ReadOnlySpan<T> span, T value, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>;
static member BinarySearch : ReadOnlySpan<'T> * 'T * 'Comparer -> int (requires 'Comparer :> System.Collections.Generic.IComparer<'T>)
<Extension()>
Public Function BinarySearch(Of T, TComparer) (span As ReadOnlySpan(Of T), value As T, comparer As TComparer) As Integer
Type Parameters
T
The element type of the span.
Parameters
value
T
The object to locate. The value can be null
for reference types.
comparer
TComparer
The TComparer
to use when comparing.
Returns
The zero-based index of value
in the sorted span
, if value
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than value
or, if there is no larger element, the bitwise complement of Length.
Exceptions
Applies to
BinarySearch<T,TComparer>(Span, T, TComparer)
Source:
Source:
Source:
Source:
Searches an entire sorted Span for a specified value using the specified TComparer
generic type.
public:
generic <typename T, typename TComparer>
where TComparer : System::Collections::Generic::IComparer<T>[System::Runtime::CompilerServices::Extension]
static int BinarySearch(Span<T> span, T value, TComparer comparer);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int BinarySearch<T,TComparer>(this Span<T> span, T value, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>, allows ref struct;
public static int BinarySearch<T,TComparer>(this Span<T> span, T value, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>;
public static int BinarySearch<T,TComparer>(this Span<T> span, T value, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>, allows ref struct;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member BinarySearch : Span<'T> * 'T * 'Comparer -> int (requires 'Comparer :> System.Collections.Generic.IComparer<'T>)
static member BinarySearch : Span<'T> * 'T * 'Comparer -> int (requires 'Comparer :> System.Collections.Generic.IComparer<'T>)
<Extension()>
Public Function BinarySearch(Of T, TComparer) (span As Span(Of T), value As T, comparer As TComparer) As Integer
Type Parameters
T
The element type of the span.
Parameters
value
T
The object to locate. The value can be null
for reference types.
comparer
TComparer
The TComparer
to use when comparing.
Returns
The zero-based index of value
in the sorted span
, if value
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than value
or, if there is no larger element, the bitwise complement of Length.
Attributes
Exceptions
Applies to
BinarySearch(ReadOnlySpan, IComparable)
Source:
Source:
Source:
Source:
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(ReadOnlySpan<T> span, IComparable<T> ^ comparable);
public static int BinarySearch<T>(this ReadOnlySpan<T> span, IComparable<T> comparable);
static member BinarySearch : ReadOnlySpan<'T> * IComparable<'T> -> int
<Extension()>
Public Function BinarySearch(Of T) (span As ReadOnlySpan(Of T), comparable As IComparable(Of T)) As Integer
Type Parameters
T
The element type of the span.
Parameters
Returns
The zero-based index of comparable
in the sorted span
, if comparable
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than comparable
or, if there is no larger element, the bitwise complement of Length.
Exceptions
Applies to
BinarySearch(Span, IComparable)
Source:
Source:
Source:
Source:
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(Span<T> span, IComparable<T> ^ comparable);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int BinarySearch<T>(this Span<T> span, IComparable<T> comparable);
public static int BinarySearch<T>(this Span<T> span, IComparable<T> comparable);
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member BinarySearch : Span<'T> * IComparable<'T> -> int
static member BinarySearch : Span<'T> * IComparable<'T> -> int
<Extension()>
Public Function BinarySearch(Of T) (span As Span(Of T), comparable As IComparable(Of T)) As Integer
Type Parameters
T
The element type of the span.
Parameters
Returns
The zero-based index of comparable
in the sorted span
, if comparable
is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than comparable
or, if there is no larger element, the bitwise complement of Length.
Attributes