ImmutableArray<T>.Builder ImmutableArray<T>.Builder ImmutableArray<T>.Builder ImmutableArray<T>.Builder Class

定义

无需分配额外的内存就能转换为 ImmutableArray<T> 实例的可写数组访问器。A writable array accessor that can be converted into an ImmutableArray<T> instance without allocating extra memory.

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

public: ref class ImmutableArray<T>::Builder sealed : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IList<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::IReadOnlyList<T>
public sealed class ImmutableArray<T>.Builder : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>
type ImmutableArray<'T>.Builder = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
Public NotInheritable Class ImmutableArray(Of T).Builder
Implements ICollection(Of T), IEnumerable(Of T), IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T)

类型参数

T
继承
ImmutableArray<T>.BuilderImmutableArray<T>.BuilderImmutableArray<T>.BuilderImmutableArray<T>.Builder
实现

属性

Capacity Capacity Capacity Capacity

获取或设置内部数组的长度。Gets or sets the length of the internal array. 设置后,如果内部数组已不是指定长度,则重新分配给定容量。When set, the internal array is reallocated to the given capacity if it is not already the specified length.

Count Count Count Count

获取或设置数组中的项数。Gets or sets the number of items in the array.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取或设置指定索引处的项。Gets or sets the item at the specified index.

方法

Add(T) Add(T) Add(T) Add(T)

将指定项添加到数组。Adds the specified item to the array.

AddRange(IEnumerable<T>) AddRange(IEnumerable<T>) AddRange(IEnumerable<T>) AddRange(IEnumerable<T>)

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>)

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>)

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

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

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

AddRange(T[]) AddRange(T[]) AddRange(T[]) AddRange(T[])

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

AddRange(T[], Int32) AddRange(T[], Int32) AddRange(T[], Int32) AddRange(T[], Int32)

将指定项添加到数组的末尾。Adds the specified items to the end of the array.

AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>)

将派生自当前位于数组中的类型的指定项添加到数组末尾。Adds the specified items that derive from the type currently in the array, to the end of the array.

AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>) AddRange<TDerived>(ImmutableArray<TDerived>)

将派生自当前位于数组中的类型的指定项添加到数组末尾。Adds the specified items that derive from the type currently in the array, to the end of the array.

AddRange<TDerived>(TDerived[]) AddRange<TDerived>(TDerived[]) AddRange<TDerived>(TDerived[]) AddRange<TDerived>(TDerived[])

将派生自当前位于数组中的类型的指定项添加到数组末尾。Adds the specified items that derive from the type currently in the array, to the end of the array.

Clear() Clear() Clear() Clear()

从数组中移除所有项。Removes all items from the array.

Contains(T) Contains(T) Contains(T) Contains(T)

确定数组是否包含特定值。Determines whether the array contains a specific value.

CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32)

将当前内容复制到指定的数组。Copies the current contents to the specified array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

获取一个可用于循环访问集合的对象。Gets an object that can be used to iterate through the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

确定数组中特定项的索引。Determines the index of a specific item in the array.

IndexOf(T, Int32) IndexOf(T, Int32) IndexOf(T, Int32) IndexOf(T, Int32)

确定指定项的索引。Determines the index of the specified item.

IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32)

确定指定项的索引。Determines the index of the specified item.

IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>)

确定指定项的索引。Determines the index for the specified item.

Insert(Int32, T) Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

在数组中指定索引的位置插入项。Inserts an item in the array at the specified index.

ItemRef(Int32) ItemRef(Int32) ItemRef(Int32) ItemRef(Int32)

获取对指定索引处的元素的只读引用。Gets a read-only reference to the element at the specified index.

LastIndexOf(T) LastIndexOf(T) LastIndexOf(T) LastIndexOf(T)

确定此数组中指定项的最后一个匹配项的从 0 开始的索引。Determines the 0-based index of the last occurrence of the specified item in this array.

LastIndexOf(T, Int32) LastIndexOf(T, Int32) LastIndexOf(T, Int32) LastIndexOf(T, Int32)

确定此数组中指定项的最后一个匹配项的从 0 开始的索引。Determines the 0-based index of the last occurrence of the specified item in this array.

LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32)

确定此数组中指定项的最后一个匹配项的从 0 开始的索引。Determines the 0-based index of the last occurrence of the specified item in this array.

LastIndexOf(T, Int32, Int32, IEqualityComparer<T>) LastIndexOf(T, Int32, Int32, IEqualityComparer<T>) LastIndexOf(T, Int32, Int32, IEqualityComparer<T>) LastIndexOf(T, Int32, Int32, IEqualityComparer<T>)

确定此数组中指定项的最后一个匹配项的从 0 开始的索引。Determines the 0-based index of the last occurrence of the specified item in this array.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
MoveToImmutable() MoveToImmutable() MoveToImmutable() MoveToImmutable()

将内部数组提取为 ImmutableArray<T>,并替换为零长度数组。Extracts the internal array as an ImmutableArray<T> and replaces it with a zero length array.

Remove(T) Remove(T) Remove(T) Remove(T)

移除指定的元素。Removes the specified element.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

从数组中移除指定索引位置的项。Removes the item at the specified index from the array.

Reverse() Reverse() Reverse() Reverse()

将集合中元素的顺序反转。Reverses the order of elements in the collection.

Sort() Sort() Sort() Sort()

对数组的内容进行排序。Sorts the contents of the array.

Sort(Comparison<T>) Sort(Comparison<T>) Sort(Comparison<T>) Sort(Comparison<T>)

使用指定的 Comparison<T>,对整个数组中的元素进行排序。Sorts the elements in the entire array using the specified Comparison<T>.

Sort(IComparer<T>) Sort(IComparer<T>) Sort(IComparer<T>) Sort(IComparer<T>)

对数组的内容进行排序。Sorts the contents of the array.

Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>)

对数组的内容进行排序。Sorts the contents of the array.

ToArray() ToArray() ToArray() ToArray()

创建一个新数组,其中包含此 ImmutableArray<T>.Builder 的当前内容。Creates a new array with the current contents of this ImmutableArray<T>.Builder.

ToImmutable() ToImmutable() ToImmutable() ToImmutable()

返回一个不可变数组,其中包含此 ImmutableArray<T>.Builder 的当前内容。Returns an immutable array that contains the current contents of this ImmutableArray<T>.Builder.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly

获取一个值,该值指示 ICollection<T> 是否为只读。Gets a value that indicates whether the ICollection<T> is read-only.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问数组的枚举器。Returns an enumerator that iterates through the array.

IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator()

返回循环访问数组的枚举器。Returns an enumerator that iterates through the array.

扩展方法

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>)

返回一个值,该值指示此集合是否包含任何元素。Returns a value indicating whether this collection contains any elements.

First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>)

返回集合中的第一个元素。Returns the first element in the collection.

FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>)

返回集合中的第一个元素;如果集合为空,则返回默认值。Returns the first element in the collection, or the default value if the collection is empty.

Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>)

返回集合中的最后一个元素。Returns the last element in the collection.

LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>)

返回集合中的最后一个元素;如果集合为空,则返回默认值。Returns the last element in the collection, or the default value if the collection is empty.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于