IImmutableList<T> IImmutableList<T> IImmutableList<T> IImmutableList<T> Interface

定义

表示无法修改的元素的列表。Represents a list of elements that cannot be modified.

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

generic <typename T>
public interface class IImmutableList : System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::IReadOnlyList<T>
public interface IImmutableList<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>
type IImmutableList<'T> = interface
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
Public Interface IImmutableList(Of T)
Implements IEnumerable(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T)

类型参数

T

列表中元素的类型。The type of elements in the list.

派生
实现

注解

当你在中IImmutableList<T>添加或删除项时, 将会创建原始列表的副本, 并会应用更改。When you add or remove items from an IImmutableList<T>, a copy of the original list is created, with the changes applied. 对列表的增量更改将尽可能多地共享列表中较早版本的内存, 并允许垃圾回收清除不再引用的任何唯一列表数据。Incremental changes to a list share as much memory as possible with earlier versions of a list and enable garbage collection to clean up any unique list data that is no longer being referenced.

有关创建IImmutableList<T>实现的信息, 请参阅System.Collections.Immutable.ImmutableList<T>For information on creating an IImmutableList<T> implementation, see System.Collections.Immutable.ImmutableList<T>.

方法

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

生成列表的副本,并将指定的对象添加到所复制列表的末尾。Makes a copy of the list, and adds the specified object to the end of the copied list.

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

生成列表的副本,并将指定的对象添加到所复制列表的末尾。Makes a copy of the list and adds the specified objects to the end of the copied list.

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

创建一个已移除所有项,但排序和顺序语义与此列表相同的列表。Creates a list with all the items removed, but with the same sorting and ordering semantics as this list.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

(Inherited from IEnumerable)
IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>) IndexOf(T, Int32, Int32, IEqualityComparer<T>)

搜索指定对象并返回 IImmutableList<T> 中从指定索引开始并包含指定元素数的这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the IImmutableList<T> that starts at the specified index and contains the specified number of elements.

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

将指定元素插入到不可变列表中的指定索引位置。Inserts the specified element at the specified index in the immutable list.

InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>)

将指定元素插入到不可变列表中的指定索引位置。Inserts the specified elements at the specified index in the immutable list.

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

搜索指定对象并返回 IImmutableList<T> 中到指定索引为止包含指定元素数的这部分元素中最后一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the IImmutableList<T> that contains the specified number of elements and ends at the specified index.

Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>)

从此不可变列表中移除指定对象的第一个匹配项。Removes the first occurrence of a specified object from this immutable list.

RemoveAll(Predicate<T>) RemoveAll(Predicate<T>) RemoveAll(Predicate<T>) RemoveAll(Predicate<T>)

移除与指定的谓词所定义的条件相匹配的所有元素。Removes all the elements that match the conditions defined by the specified predicate.

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

移除不可变列表中指定索引处的元素。Removes the element at the specified index of the immutable list.

RemoveRange(IEnumerable<T>, IEqualityComparer<T>) RemoveRange(IEnumerable<T>, IEqualityComparer<T>) RemoveRange(IEnumerable<T>, IEqualityComparer<T>) RemoveRange(IEnumerable<T>, IEqualityComparer<T>)

从列表中移除指定的对象。Removes the specified object from the list.

RemoveRange(Int32, Int32) RemoveRange(Int32, Int32) RemoveRange(Int32, Int32) RemoveRange(Int32, Int32)

IImmutableList<T> 中移除一定范围的元素。Removes a range of elements from the IImmutableList<T>.

Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>)

返回一个新列表,其中的第一个匹配元素已被替换为指定的元素。Returns a new list with the first matching element in the list replaced with the specified element.

SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T)

将列表中位于给定位置的元素替换为指定的元素。Replaces an element in the list at a given position with the specified element.

属性

Count Count Count Count

获取集合中的元素数。Gets the number of elements in the collection.

(Inherited from IReadOnlyCollection<T>)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取位于只读列表中指定索引处的元素。Gets the element at the specified index in the read-only list.

(Inherited from IReadOnlyList<T>)

扩展方法

IndexOf<T>(IImmutableList<T>, T) IndexOf<T>(IImmutableList<T>, T) IndexOf<T>(IImmutableList<T>, T) IndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.

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

搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

LastIndexOf<T>(IImmutableList<T>, T) LastIndexOf<T>(IImmutableList<T>, T) LastIndexOf<T>(IImmutableList<T>, T) LastIndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

Remove<T>(IImmutableList<T>, T) Remove<T>(IImmutableList<T>, T) Remove<T>(IImmutableList<T>, T) Remove<T>(IImmutableList<T>, T)

从此列表中移除指定的值。Removes the specified value from this list.

RemoveRange<T>(IImmutableList<T>, IEnumerable<T>) RemoveRange<T>(IImmutableList<T>, IEnumerable<T>) RemoveRange<T>(IImmutableList<T>, IEnumerable<T>) RemoveRange<T>(IImmutableList<T>, IEnumerable<T>)

从此列表中移除指定的值。Removes the specified values from this list.

Replace<T>(IImmutableList<T>, T, T) Replace<T>(IImmutableList<T>, T, T) Replace<T>(IImmutableList<T>, T, T) Replace<T>(IImmutableList<T>, T, T)

将列表中第一个相等的元素替换为指定的元素。Replaces the first equal element in the list with the specified element.

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.

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.

适用于