ImmutableArray 类

定义

提供用于创建不可变数组的方法;这意味着,该数组在创建后不可更改。Provides methods for creating an array that is immutable; meaning it cannot be changed once it is created.

NuGet package: System.Collections.Immutable关于不可变集合和安装方法NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public ref class ImmutableArray abstract sealed
public static class ImmutableArray
type ImmutableArray = class
Public Module ImmutableArray
继承
ImmutableArray

方法

BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T)

在已排序的不可变数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。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>)

在已排序的不可变数组中搜索指定的元素,并返回该元素的从零开始的索引。Searches a sorted immutable array for a specified element and returns the zero-based index of the element.

BinarySearch<T>(ImmutableArray<T>, T)

使用默认比较器在已排序的数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。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>)

在已排序的不可变数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

Create<T>()

创建一个空的不可变数组。Creates an empty immutable array.

Create<T>(ImmutableArray<T>, Int32, Int32)

从另一个不可变数组创建包含指定对象的不可变数组。Creates an immutable array with the specified objects from another immutable array.

Create<T>(T)

创建一个包含指定对象的不可变数组。Creates an immutable array that contains the specified object.

Create<T>(T, T)

创建一个包含指定对象的不可变数组。Creates an immutable array that contains the specified objects.

Create<T>(T, T, T)

创建一个包含指定对象的不可变数组。Creates an immutable array that contains the specified objects.

Create<T>(T, T, T, T)

创建一个包含指定对象的不可变数组。Creates an immutable array that contains the specified objects.

Create<T>(T[])

从指定的对象数组创建一个不可变数组。Creates an immutable array from the specified array of objects.

Create<T>(T[], Int32, Int32)

从另一个数组创建包含指定对象的不可变数组。Creates an immutable array with specified objects from another array.

CreateBuilder<T>()

创建无需分配新内存就能转换为 ImmutableArray 的可变数组。Creates a mutable array that can be converted to an ImmutableArray without allocating new memory.

CreateBuilder<T>(Int32)

创建无需分配新内存就能转换为 ImmutableArray 的可变数组。Creates a mutable array that can be converted to an ImmutableArray without allocating new memory.

CreateRange<T>(IEnumerable<T>)

创建一个填充了指定项的新 ImmutableArray<T>Creates a new ImmutableArray<T> populated with the specified items.

CreateRange<TSource,TArg,TResult>(ImmutableArray<TSource>, Func<TSource,TArg,TResult>, TArg)

初始化 ImmutableArray<T> 结构的新实例。Initializes a new instance of the ImmutableArray<T> struct.

CreateRange<TSource,TArg,TResult>(ImmutableArray<TSource>, Int32, Int32, Func<TSource,TArg,TResult>, TArg)

初始化 ImmutableArray<T> 结构的新实例。Initializes a new instance of the ImmutableArray<T> struct.

CreateRange<TSource,TResult>(ImmutableArray<TSource>, Func<TSource,TResult>)

初始化 ImmutableArray<T> 结构的新实例。Initializes a new instance of the ImmutableArray<T> struct.

CreateRange<TSource,TResult>(ImmutableArray<TSource>, Int32, Int32, Func<TSource,TResult>)

初始化 ImmutableArray<T> 结构的新实例。Initializes a new instance of the ImmutableArray<T> struct.

ToImmutableArray<TSource>(IEnumerable<TSource>)

从指定的集合创建一个不可变数组。Creates an immutable array from the specified collection.

ToImmutableArray<TSource>(ImmutableArray<TSource>)

从生成器数组的当前内容创建不可变数组。Creates an immutable array from the current contents of the builder's array.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.