ImmutableList<T>.Builder.BinarySearch 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| BinarySearch(T) |
使用默认比较器搜索整个 ImmutableList<T>.Builder 元素,并返回元素的从零开始的索引。 |
| BinarySearch(T, IComparer<T>) |
使用指定的比较器搜索整个 ImmutableList<T>.Builder 元素,并返回元素的从零开始的索引。 |
| BinarySearch(Int32, Int32, T, IComparer<T>) |
使用指定的比较器搜索元素的 ImmutableList<T>.Builder 指定范围,并返回元素的从零开始的索引。 |
BinarySearch(T)
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
使用默认比较器搜索整个 ImmutableList<T>.Builder 元素,并返回元素的从零开始的索引。
public:
virtual int BinarySearch(T item);
public:
int BinarySearch(T item);
public int BinarySearch(T item);
abstract member BinarySearch : 'T -> int
override this.BinarySearch : 'T -> int
member this.BinarySearch : 'T -> int
Public Function BinarySearch (item As T) As Integer
参数
- item
- T
要查找的对象。 对于引用类型,该值可以为 null。
返回
如果找到项, ImmutableList<T>.Builder则为项的从零开始的索引;否则为负数,表示下一个大于 item的元素索引的按位补数。
例外
默认比较器 Default 找不到泛型接口的 IComparable<T> 实现或类型 T 的 IComparable 接口。
注解
ImmutableList<T>.Builder如果不包含指定值,该方法将返回负整数。 可以将按位补运算 (~) 应用于此负整数,以获取大于搜索值的第一个元素的索引。 将值 ImmutableList<T>.Builder插入到该索引中时,此索引应用作插入点来维护排序顺序。
适用于
BinarySearch(T, IComparer<T>)
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
使用指定的比较器搜索整个 ImmutableList<T>.Builder 元素,并返回元素的从零开始的索引。
public:
virtual int BinarySearch(T item, System::Collections::Generic::IComparer<T> ^ comparer);
public:
int BinarySearch(T item, System::Collections::Generic::IComparer<T> ^ comparer);
public int BinarySearch(T item, System.Collections.Generic.IComparer<T> comparer);
public int BinarySearch(T item, System.Collections.Generic.IComparer<T>? comparer);
abstract member BinarySearch : 'T * System.Collections.Generic.IComparer<'T> -> int
override this.BinarySearch : 'T * System.Collections.Generic.IComparer<'T> -> int
member this.BinarySearch : 'T * System.Collections.Generic.IComparer<'T> -> int
Public Function BinarySearch (item As T, comparer As IComparer(Of T)) As Integer
参数
- item
- T
要查找的对象。 对于引用类型,此值可以为 null。
- comparer
- IComparer<T>
比较元素 null 或默认比较器时要使用的实现。
返回
如果找到项, ImmutableList<T>.Builder则为项的从零开始的索引;否则为负数,表示下一个大于 item的元素索引的按位补数。
例外
comparer 是 null,并且默认比较器 Default 找不到泛型接口的 IComparable<T> 实现或类型 T 的 IComparable 接口。
注解
ImmutableList<T>.Builder如果不包含指定值,该方法将返回负整数。 可以将按位补运算 (~) 应用于此负整数,以获取大于搜索值的第一个元素的索引。 将值 ImmutableList<T>.Builder插入到该索引中时,此索引应用作插入点来维护排序顺序。
适用于
BinarySearch(Int32, Int32, T, IComparer<T>)
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
- Source:
- ImmutableList_1.Builder.cs
使用指定的比较器搜索元素的 ImmutableList<T>.Builder 指定范围,并返回元素的从零开始的索引。
public:
virtual int BinarySearch(int index, int count, T item, System::Collections::Generic::IComparer<T> ^ comparer);
public:
int BinarySearch(int index, int count, T item, System::Collections::Generic::IComparer<T> ^ comparer);
public int BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer<T> comparer);
public int BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer<T>? comparer);
abstract member BinarySearch : int * int * 'T * System.Collections.Generic.IComparer<'T> -> int
override this.BinarySearch : int * int * 'T * System.Collections.Generic.IComparer<'T> -> int
member this.BinarySearch : int * int * 'T * System.Collections.Generic.IComparer<'T> -> int
Public Function BinarySearch (index As Integer, count As Integer, item As T, comparer As IComparer(Of T)) As Integer
参数
- index
- Int32
要搜索的范围从零开始的索引。
- count
- Int32
要搜索的范围的长度。
- item
- T
要查找的对象。 对于引用类型,此值可以为 null。
- comparer
- IComparer<T>
比较元素 null 或默认比较器时要使用的实现。
返回
如果找到项, ImmutableList<T>.Builder则为项的从零开始的索引;否则为负数,表示下一个大于 item的元素索引的按位补数。
例外
index 并且 count 不表示 . List<T>. 中的有效范围。
comparer 是 null,并且默认比较器 Default 找不到泛型接口的 IComparable<T> 实现或类型 T 的 IComparable 接口。
注解
ImmutableList<T>.Builder如果不包含指定值,该方法将返回负整数。 可以将按位补运算 (~) 应用于此负整数,以获取大于搜索值的第一个元素的索引。 将值 ImmutableList<T>.Builder插入到该索引中时,此索引应用作插入点来维护排序顺序。