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

Extension Methods

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

傳回DataTable,其中包含副本DataRow物件,指定輸入IEnumerable<T>物件其中泛型參數TDataRowReturns 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)

複本DataRow至指定的物件DataTable,根據輸入IEnumerable<T>物件其中泛型參數TDataRowCopies 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)

複本DataRow至指定的物件DataTable,根據輸入IEnumerable<T>物件其中泛型參數TDataRowCopies 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)

將轉換IEnumerableIQueryableConverts 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.

適用於