ImmutableList<T>.Builder 類別

定義

代表有少量或沒有記憶體配置變動的清單,這個清單可以非常有效率的方式產生或建置於不可變的清單執行個體上。Represents a list that mutates with little or no memory allocations and that can produce or build on immutable list instances very efficiently.

NuGet 套件System.Collections.Immutable (關於固定集合及其安裝方法)NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public: ref class ImmutableList<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>, System::Collections::IList
public sealed class ImmutableList<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>, System.Collections.IList
type ImmutableList<'T>.Builder = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
    interface ICollection
    interface IList
Public NotInheritable Class ImmutableList(Of T).Builder
Implements ICollection(Of T), IEnumerable(Of T), IList, IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T)

類型參數

T
繼承
ImmutableList<T>.Builder
實作

備註

雖然 ImmutableList<T>.AddRange 和其他方法已經在清單上提供快速的大量變更作業,但 @no__t 1 類別允許對具有相同效率的清單進行多個變更組合。Although ImmutableList<T>.AddRange and other methods already provide fast bulk change operations on the list, the ImmutableList<T>.Builder class allows multiple combinations of changes to be made to a list with equal efficiency.

屬性

Count

取得這個不可變清單中的項目數。Gets the number of elements in this immutable list.

Item[Int32]

取得或設定清單中指定索引的值。Gets or sets the value for a given index in the list.

方法

Add(T)

將項目加入不可變的清單中。Adds an item to the immutable list.

AddRange(IEnumerable<T>)

將一連串項目加入至這個清單的結尾。Adds a series of elements to the end of this list.

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

使用指定的比較子來搜尋項目之指定範圍的 ImmutableList<T>.Builder,並傳回項目以零為起始的索引。Searches the specified range of the ImmutableList<T>.Builder for an element using the specified comparer and returns the zero-based index of the element.

BinarySearch(T)

使用預設的比較子來搜尋項目的整個 ImmutableList<T>.Builder,並傳回項目以零為起始的索引。Searches the entire ImmutableList<T>.Builder for an element using the default comparer and returns the zero-based index of the element.

BinarySearch(T, IComparer<T>)

使用指定的比較子並傳回項目以零為起始的索引,來搜尋項目的整個 ImmutableList<T>.BuilderSearches the entire ImmutableList<T>.Builder for an element using the specified comparer and returns the zero-based index of the element.

Clear()

從不可變的清單中移除所有項目。Removes all items from the immutable list.

Contains(T)

判斷不可變的清單是否包含特定值。Determines whether the immutable list contains a specific value.

ConvertAll<TOutput>(Func<T,TOutput>)

使用轉換器函式,從這個產生器所代表的清單中建立新的不可變清單。Creates a new immutable list from the list represented by this builder by using the converter function.

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

從目標陣列的指定索引處開始,將整個不可變的清單複製到相容的一維陣列。Copies the entire immutable list to a compatible one-dimensional array, starting at the specified index of the target array.

CopyTo(T[])

從目標陣列的開頭開始,將整個不可變的清單複製到相容的一維陣列。Copies the entire immutable list to a compatible one-dimensional array, starting at the beginning of the target array.

CopyTo(T[], Int32)

從目標陣列的指定索引處開始,將整個不可變的清單複製到相容的一維陣列。Copies the entire immutable list to a compatible one-dimensional array, starting at the specified index of the target array.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Exists(Predicate<T>)

判斷不可變的清單是否包含符合指定述詞所定義之條件的項目。Determines whether the immutable list contains elements that match the conditions defined by the specified predicate.

Find(Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回整個不可變清單內第一個出現的項目。Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire immutable list.

FindAll(Predicate<T>)

擷取符合指定之述詞所定義的條件之所有項目。Retrieves all the elements that match the conditions defined by the specified predicate.

FindIndex(Int32, Int32, Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回不可變的清單中,從指定索引開始且包含指定項目數的項目範圍內,第一個出現項目以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the immutable list that starts at the specified index and contains the specified number of elements.

FindIndex(Int32, Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回不可變的清單中,從指定索引開始到最後一個項目的項目範圍內,第一個出現項目以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, 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.

FindIndex(Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回整個不可變清單內第一個出現項目之以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire immutable list.

FindLast(Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回整個不可變清單內最後一個出現的項目。Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire immutable list.

FindLastIndex(Int32, Int32, Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回不可變的清單中,包含指定項目數且結束於指定索引的項目範圍內,最後一個出現項目以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the immutable list that contains the specified number of elements and ends at the specified index.

FindLastIndex(Int32, Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回不可變的清單中,從第一個項目開始到指定索引的項目範圍內,最後一個出現項目以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, 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.

FindLastIndex(Predicate<T>)

搜尋符合指定述詞所定義之條件的項目,並傳回整個不可變清單內最後一個出現項目以零為起始的索引。Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire immutable list.

ForEach(Action<T>)

在清單的每一個項目上執行指定動作。Performs the specified action on each element of the list.

GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetRange(Int32, Int32)

為來源不可變清單中的項目範圍建立淺層複本。Creates a shallow copy of a range of elements in the source immutable list.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(T)

搜尋指定的物件,並傳回不可變清單中的項目範圍內第一個出現項目以零為起始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list.

IndexOf(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, 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 starts at the specified index and contains the specified number of elements.

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

ImmutableList<T>.Builder 中從指定索引開始且包含指定個數項目的範圍內,搜尋指定的物件第一次出現的位置,並傳回其索引值 (索引以零為起始)。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ImmutableList<T>.Builder that starts at the specified index and contains the specified number of elements.

Insert(Int32, T)

將項目插入不可變清單的指定索引處。Inserts an item to the immutable list at the specified index.

InsertRange(Int32, IEnumerable<T>)

將集合的項目插入不可變清單的指定索引處。Inserts the elements of a collection into the immutable list at the specified index.

ItemRef(Int32)

取得清單中指定 index 值的唯讀參考。Gets a read-only reference to the value for a given index into the list.

LastIndexOf(T)

搜尋指定的物件,並傳回整個不可變的清單中最後一個出現項目以零為起始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

LastIndexOf(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, 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 contains the specified number of elements and ends at the specified index.

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

搜尋指定的物件,並傳回不可變的清單中,包含指定項目數且結尾位於指定索引處的項目範圍內,最後一個出現項目以零為起始的索引。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 contains the specified number of elements and ends at the specified index.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(T)

從不可變的清單中移除第一個出現的特定物件。Removes the first occurrence of a specific object from the immutable list.

RemoveAll(Predicate<T>)

移除符合指定的述詞所定義之條件的所有項目。Removes all the elements that match the conditions defined by the specified predicate.

RemoveAt(Int32)

移除位於不可變清單之指定索引處的項目。Removes the item at the specified index of the immutable list.

Reverse()

反轉整個不可變清單中項目的順序。Reverses the order of the elements in the entire immutable list.

Reverse(Int32, Int32)

反轉不可變清單之指定範圍中項目的順序。Reverses the order of the elements in the specified range of the immutable list.

Sort()

使用預設的比較子,來排序整個不可變清單中的項目。Sorts the elements in the entire immutable list by using the default comparer.

Sort(Comparison<T>)

使用指定的比較物件,來排序整個不可變清單中的項目。Sorts the elements in the entire immutable list by using the specified comparison object.

Sort(IComparer<T>)

使用指定的比較子,來排序整個不可變清單中的項目。Sorts the elements in the entire immutable list by using the specified comparer.

Sort(Int32, Int32, IComparer<T>)

使用指定的比較子,來排序不可變清單之項目範圍內的項目。Sorts the elements in a range of elements in the immutable list by using the specified comparer.

ToImmutable()

根據這個執行個體的內容來建立不可變的清單。Creates an immutable list based on the contents of this instance.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TrueForAll(Predicate<T>)

判斷不可變清單中的每一個項目是否符合指定述詞所定義的條件。Determines whether every element in the immutable list matches the conditions defined by the specified predicate.

明確介面實作

ICollection.CopyTo(Array, Int32)

從特定的陣列索引開始,將清單的項目複製到陣列中。Copies the elements of the list to an array, starting at a particular array index.

ICollection.IsSynchronized

取得值,這個值會指出 ICollection 的存取是否同步 (具備安全執行緒)。Gets a value that indicates 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

取得值,這個值表示此執行個體是否為唯讀。Gets a value that indicates whether this instance is read-only.

IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

IEnumerable<T>.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

IList.Add(Object)

將項目加入清單。Adds an item to the list.

IList.Clear()

從清單中移除所有項目。Removes all items from the list.

IList.Contains(Object)

判斷清單是否包含特定值。Determines whether the list contains a specific value.

IList.IndexOf(Object)

判斷清單中特定項目的索引。Determines the index of a specific item in the list.

IList.Insert(Int32, Object)

將項目插入清單的指定索引處。Inserts an item to the list at the specified index.

IList.IsFixedSize

取得值,指出 IList 是否有固定的大小。Gets a value that indicates whether the IList has a fixed size.

IList.IsReadOnly

取得值,這個值表示 ICollection<T> 是否為唯讀。Gets a value that indicates whether the ICollection<T> is read-only.

IList.Item[Int32]

取得或設定在指定索引處的 ObjectGets or sets the Object at the specified index.

IList.Remove(Object)

從清單中移除第一個出現的特定物件。Removes the first occurrence of a specific object from the list.

擴充方法

CopyToDataTable<T>(IEnumerable<T>)

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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.

適用於