ImmutableArray.BinarySearch Método
Definição
Sobrecargas
| BinarySearch<T>(ImmutableArray<T>, T) |
Pesquisa um elemento especificado na matriz classificada imutável usando o comparador padrão e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches the sorted immutable array for a specified element using the default comparer and returns the zero-based index of the element, if it's found. |
| BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>) |
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found. |
| BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T) |
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found. |
| BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>) |
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento.Searches a sorted immutable array for a specified element and returns the zero-based index of the element. |
BinarySearch<T>(ImmutableArray<T>, T)
Pesquisa um elemento especificado na matriz classificada imutável usando o comparador padrão e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches the sorted immutable array for a specified element using the default comparer and returns the zero-based index of the element, if it's found.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(System::Collections::Immutable::ImmutableArray<T> array, T value);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, T value);
static member BinarySearch : System.Collections.Immutable.ImmutableArray<'T> * 'T -> int
<Extension()>
Public Function BinarySearch(Of T) (array As ImmutableArray(Of T), value As T) As Integer
Parâmetros de tipo
- T
O tipo de elemento armazenado na matriz.The type of element stored in the array.
Parâmetros
- array
- ImmutableArray<T>
A matriz classificada para pesquisar.The sorted array to search.
- value
- T
O objeto a ser procurado.The object to search for.
Retornos
O índice baseado em zero do item na matriz, se o item for encontrado; caso contrário, um número negativo que é o complemento bit a bit do índice do próximo elemento maior que value ou, se não houver nenhum elemento maior, o complemento bit a bit de Count.The zero-based index of the item in the array, if item 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 Count.
Exceções
value não implementa IComparable ou a pesquisa encontra um elemento que não implementa IComparable.value does not implement IComparable or the search encounters an element that does not implement IComparable.
Aplica-se a
BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>)
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(System::Collections::Immutable::ImmutableArray<T> array, T value, System::Collections::Generic::IComparer<T> ^ comparer);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, T value, System.Collections.Generic.IComparer<T> comparer);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, T value, System.Collections.Generic.IComparer<T>? comparer);
static member BinarySearch : System.Collections.Immutable.ImmutableArray<'T> * 'T * System.Collections.Generic.IComparer<'T> -> int
<Extension()>
Public Function BinarySearch(Of T) (array As ImmutableArray(Of T), value As T, comparer As IComparer(Of T)) As Integer
Parâmetros de tipo
- T
O tipo de elemento armazenado na matriz.The type of element stored in the array.
Parâmetros
- array
- ImmutableArray<T>
A matriz classificada para pesquisar.The sorted array to search.
- value
- T
O objeto a ser procurado.The object to search for.
- comparer
- IComparer<T>
A implementação de comparador a ser usada na comparação de elementos ou nulo para usar o comparador padrão.The comparer implementation to use when comparing elements, or null to use the default comparer.
Retornos
O índice baseado em zero do item na matriz, se o item for encontrado; caso contrário, um número negativo que é o complemento bit a bit do índice do próximo elemento maior que value ou, se não houver nenhum elemento maior, o complemento bit a bit de Count.The zero-based index of the item in the array, if item 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 Count.
Exceções
comparer é nulo e value não implementa IComparable ou a pesquisa encontra um elemento que não implementa IComparable.comparer is null and value does not implement IComparable or the search encounters an element that does not implement IComparable.
Aplica-se a
BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T)
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento, se ele é encontrado.Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(System::Collections::Immutable::ImmutableArray<T> array, int index, int length, T value);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, int index, int length, T value);
static member BinarySearch : System.Collections.Immutable.ImmutableArray<'T> * int * int * 'T -> int
<Extension()>
Public Function BinarySearch(Of T) (array As ImmutableArray(Of T), index As Integer, length As Integer, value As T) As Integer
Parâmetros de tipo
- T
O tipo de elemento armazenado na matriz.The type of element stored in the array.
Parâmetros
- array
- ImmutableArray<T>
A matriz classificada para pesquisar.The sorted array to search.
- index
- Int32
O índice inicial do intervalo a ser procurado.The starting index of the range to search.
- length
- Int32
O tamanho do intervalo a ser procurado.The length of the range to search.
- value
- T
O objeto a ser procurado.The object to search for.
Retornos
O índice baseado em zero do item na matriz, se o item for encontrado; caso contrário, um número negativo que é o complemento bit a bit do índice do próximo elemento maior que value ou, se não houver nenhum elemento maior, o complemento bit a bit de Count.The zero-based index of the item in the array, if item 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 Count.
Exceções
value não implementa IComparable ou a pesquisa encontra um elemento que não implementa IComparable.value does not implement IComparable or the search encounters an element that does not implement IComparable.
index e length não especificam um intervalo válido em array.index and length do not specify a valid range in array.
index é menor que o limite inferior de array.index is less than the lower bound of array.
- ou --or-
length é menor que zero.length is less than zero.
Aplica-se a
BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>)
Pesquisa um elemento especificado em uma matriz classificada imutável e retorna o índice baseado em zero do elemento.Searches a sorted immutable array for a specified element and returns the zero-based index of the element.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static int BinarySearch(System::Collections::Immutable::ImmutableArray<T> array, int index, int length, T value, System::Collections::Generic::IComparer<T> ^ comparer);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, int index, int length, T value, System.Collections.Generic.IComparer<T> comparer);
public static int BinarySearch<T> (this System.Collections.Immutable.ImmutableArray<T> array, int index, int length, T value, System.Collections.Generic.IComparer<T>? comparer);
static member BinarySearch : System.Collections.Immutable.ImmutableArray<'T> * int * int * 'T * System.Collections.Generic.IComparer<'T> -> int
<Extension()>
Public Function BinarySearch(Of T) (array As ImmutableArray(Of T), index As Integer, length As Integer, value As T, comparer As IComparer(Of T)) As Integer
Parâmetros de tipo
- T
O tipo de elemento armazenado na matriz.The type of element stored in the array.
Parâmetros
- array
- ImmutableArray<T>
A matriz classificada para pesquisar.The sorted array to search.
- index
- Int32
O índice inicial do intervalo a ser procurado.The starting index of the range to search.
- length
- Int32
O tamanho do intervalo a ser procurado.The length of the range to search.
- value
- T
O objeto a ser procurado.The object to search for.
- comparer
- IComparer<T>
O comparador a ser usado na comparação da igualdade de elementos ou null para usar o comparador padrão.The comparer to use when comparing elements for equality or null to use the default comparer.
Retornos
O índice baseado em zero do item na matriz, se o item for encontrado; caso contrário, um número negativo que é o complemento bit a bit do índice do próximo elemento maior que value ou, se não houver nenhum elemento maior, o complemento bit a bit de Count.The zero-based index of the item in the array, if item 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 Count.
Exceções
comparer é nulo e value não implementa IComparable ou a pesquisa encontra um elemento que não implementa IComparable.comparer is null and value does not implement IComparable or the search encounters an element that does not implement IComparable.
index e length não especificam um intervalo válido em array.index and length do not specify a valid range in array.
- ou --or-
comparer é null, e value é de um tipo que não é compatível com os elementos de array.comparer is null, and value is of a type that is not compatible with the elements of array.
index é menor que o limite inferior de array.index is less than the lower bound of array.
- ou --or-
length é menor que zero.length is less than zero.