ReadOnlyCollectionBuilder<T> 类

定义

只读集合的生成器。The builder for read only collection.

generic <typename T>
public ref class ReadOnlyCollectionBuilder sealed : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IList<T>, System::Collections::IList
[System.Serializable]
public sealed class ReadOnlyCollectionBuilder<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.IList
type ReadOnlyCollectionBuilder<'T> = class
    interface IList<'T>
    interface IList
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface ICollection
Public NotInheritable Class ReadOnlyCollectionBuilder(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IList, IList(Of T)

类型参数

T

集合元素的类型。The type of the collection element.

继承
ReadOnlyCollectionBuilder<T>
属性
实现

构造函数

ReadOnlyCollectionBuilder<T>()

构造一个 ReadOnlyCollectionBuilder<T>Constructs a ReadOnlyCollectionBuilder<T>.

ReadOnlyCollectionBuilder<T>(IEnumerable<T>)

构造 ReadOnlyCollectionBuilder<T>,并复制给定集合的内容。Constructs a ReadOnlyCollectionBuilder<T>, copying the contents of the given collection.

ReadOnlyCollectionBuilder<T>(Int32)

构造具有给定初始容量的 ReadOnlyCollectionBuilder<T>Constructs a ReadOnlyCollectionBuilder<T> with a given initial capacity. 内容为空,但是在需要进行任何重新分配之前生成器将为给定数量的元素保留空间。The contents are empty but builder will have reserved room for the given number of elements before any reallocations are required.

属性

Capacity

获取或设置此 ReadOnlyCollectionBuilder<T> 的容量。Gets or sets the capacity of this ReadOnlyCollectionBuilder<T>.

Count

获取 ReadOnlyCollectionBuilder<T> 中的元素数。Gets the number of elements in the ReadOnlyCollectionBuilder<T>.

Item[Int32]

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

方法

Add(T)

将某项添加到 ReadOnlyCollectionBuilder<T> 中。Adds an item to the ReadOnlyCollectionBuilder<T>.

Clear()

ReadOnlyCollectionBuilder<T> 中移除所有项。Removes all items from the ReadOnlyCollectionBuilder<T>.

Contains(T)

确定 ReadOnlyCollectionBuilder<T> 是否包含特定值。Determines whether the ReadOnlyCollectionBuilder<T> contains a specific value.

CopyTo(T[], Int32)

从特定的 Array 索引开始,将 ReadOnlyCollectionBuilder<T> 的元素复制到 Array 中。Copies the elements of the ReadOnlyCollectionBuilder<T> to an Array, starting at particular Array index.

Equals(Object)

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

(继承自 Object)
GetEnumerator()

返回一个循环访问集合的枚举器。Returns an enumerator that iterates through the collection.

GetHashCode()

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

(继承自 Object)
GetType()

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

(继承自 Object)
IndexOf(T)

返回生成器中给定值的第一个匹配项的索引。Returns the index of the first occurrence of a given value in the builder.

Insert(Int32, T)

ReadOnlyCollectionBuilder<T> 中的指定索引处插入一个项。Inserts an item to the ReadOnlyCollectionBuilder<T> at the specified index.

MemberwiseClone()

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

(继承自 Object)
Remove(T)

ReadOnlyCollectionBuilder<T> 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the ReadOnlyCollectionBuilder<T>.

RemoveAt(Int32)

移除位于指定索引处的 ReadOnlyCollectionBuilder<T> 项。Removes the ReadOnlyCollectionBuilder<T> item at the specified index.

Reverse()

将整个 ReadOnlyCollectionBuilder<T> 中元素的顺序反转。Reverses the order of the elements in the entire ReadOnlyCollectionBuilder<T>.

Reverse(Int32, Int32)

将指定范围中元素的顺序反转。Reverses the order of the elements in the specified range.

ToArray()

ReadOnlyCollectionBuilder<T> 的元素复制到新数组中。Copies the elements of the ReadOnlyCollectionBuilder<T> to a new array.

ToReadOnlyCollection()

创建一个包含 ReadOnlyCollectionBuilder<T> 的所有元素的 ReadOnlyCollection<T>,避免将元素复制到新数组(如果可能)。Creates a ReadOnlyCollection<T> containing all of the elements of the ReadOnlyCollectionBuilder<T>, avoiding copying the elements to the new array if possible. 创建 ReadOnlyCollection<T> 后重置 ReadOnlyCollectionBuilder<T>Resets the ReadOnlyCollectionBuilder<T> after the ReadOnlyCollection<T> has been created.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

ICollection.CopyTo(Array, Int32)

从特定的数组索引处开始,将 ICollection<T> 的元素复制到一个数组中。Copies the elements of the ICollection<T> to an array, starting at the specified array index.

ICollection.IsSynchronized

获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot

获取可用于同步对 ICollection的访问的对象。Gets an object that can be used to synchronize access to the ICollection.

ICollection<T>.IsReadOnly

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

IEnumerable.GetEnumerator()

返回一个循环访问集合的枚举器。Returns an enumerator that iterates through the collection.

IList.Add(Object)

将某项添加到 IList 中。Adds an item to the IList.

IList.Contains(Object)

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

IList.IndexOf(Object)

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

IList.Insert(Int32, Object)

IList 中的指定索引处插入一个项。Inserts an item to the IList at the specified index.

IList.IsFixedSize

获取一个值,该值指示 IList 是否具有固定大小。Gets a value indicating whether the IList has a fixed size.

IList.IsReadOnly

获取一个值,该值指示 IList 是否为只读。Gets a value indicating whether the IList is read-only.

IList.Item[Int32]

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

IList.Remove(Object)

IList 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the IList.

扩展方法

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)

在给定其泛型参数 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)

在给定其泛型参数 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)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

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

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

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)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。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>)

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

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)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。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>)

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

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>)

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

Nodes<T>(IEnumerable<T>)

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

Remove<T>(IEnumerable<T>)

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

适用于