ImmutableDictionary<TKey,TValue>.Builder ImmutableDictionary<TKey,TValue>.Builder ImmutableDictionary<TKey,TValue>.Builder ImmutableDictionary<TKey,TValue>.Builder Class

定義

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

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

public: ref class ImmutableDictionary<TKey, TValue>::Builder sealed : System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IDictionary<TKey, TValue>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyCollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyDictionary<TKey, TValue>, System::Collections::IDictionary
public sealed class ImmutableDictionary<TKey,TValue>.Builder : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IDictionary<TKey,TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>, System.Collections.IDictionary
type ImmutableDictionary<'Key, 'Value>.Builder = class
    interface ICollection<KeyValuePair<'Key, 'Value>>
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
    interface IDictionary<'Key, 'Value>
    interface IReadOnlyCollection<KeyValuePair<'Key, 'Value>>
    interface IReadOnlyDictionary<'Key, 'Value>
    interface ICollection
    interface IDictionary
Public NotInheritable Class ImmutableDictionary(Of TKey, TValue).Builder
Implements ICollection(Of KeyValuePair(Of TKey, TValue)), IDictionary, IDictionary(Of TKey, TValue), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IReadOnlyCollection(Of KeyValuePair(Of TKey, TValue)), IReadOnlyDictionary(Of TKey, TValue)

類型參數

TKey
TValue
繼承
ImmutableDictionary<TKey,TValue>.BuilderImmutableDictionary<TKey,TValue>.BuilderImmutableDictionary<TKey,TValue>.BuilderImmutableDictionary<TKey,TValue>.Builder
實作

備註

雖然ImmutableDictionary<TKey,TValue>.AddRange和其他方法提供快速的大量變更作業集合,ImmutableDictionary<TKey,TValue>.Builder類別可讓多個組合的變更會對一組相同的效率。Although ImmutableDictionary<TKey,TValue>.AddRange and other methods already provide fast bulk change operations on a collection, the ImmutableDictionary<TKey,TValue>.Builder class allows multiple combinations of changes to be made to a set with equal efficiency.

屬性

Count Count Count Count

取得不可變字典中所包含的項目數。Gets the number of elements contained in the immutable dictionary.

Item[TKey] Item[TKey] Item[TKey] Item[TKey]

取得或設定具有指定索引鍵的項目。Gets or sets the element with the specified key.

KeyComparer KeyComparer KeyComparer KeyComparer

取得或設定索引鍵比較子。Gets or sets the key comparer.

Keys Keys Keys Keys

取得集合,其中包含不可變字典的索引鍵。Gets a collection that contains the keys of the immutable dictionary.

ValueComparer ValueComparer ValueComparer ValueComparer

取得或設定值比較子。Gets or sets the value comparer.

Values Values Values Values

取得集合,其中包含不可變字典的值。Gets a collection that contains the values of the immutable dictionary.

方法

Add(KeyValuePair<TKey,TValue>) Add(KeyValuePair<TKey,TValue>) Add(KeyValuePair<TKey,TValue>) Add(KeyValuePair<TKey,TValue>)

將指定的項目加入不可變的字典。Adds the specified item to the immutable dictionary.

Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)

將具有指定索引鍵和值的項目加入不可變的字典。Adds an element that has the specified key and value to the immutable dictionary.

AddRange(IEnumerable<KeyValuePair<TKey,TValue>>) AddRange(IEnumerable<KeyValuePair<TKey,TValue>>) AddRange(IEnumerable<KeyValuePair<TKey,TValue>>) AddRange(IEnumerable<KeyValuePair<TKey,TValue>>)

將一連串的值加入這個集合。Adds a sequence of values to this collection.

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

從不可變的字典中移除所有項目。Removes all items from the immutable dictionary.

Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>)

判斷不可變的字典是否包含特定值。Determines whether the immutable dictionary contains a specific value.

ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)

判斷不可變的字典是否包含具有指定索引鍵的項目。Determines whether the immutable dictionary contains an element that has the specified key.

ContainsValue(TValue) ContainsValue(TValue) ContainsValue(TValue) ContainsValue(TValue)

判斷不可變的字典是否包含具有指定值的項目。Determines whether the immutable dictionary contains an element that has the specified value.

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

傳回逐一查看不可變字典的列舉程式。Returns an enumerator that iterates through the immutable dictionary.

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)
GetValueOrDefault(TKey) GetValueOrDefault(TKey) GetValueOrDefault(TKey) GetValueOrDefault(TKey)

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。Gets the value for a given key if a matching key exists in the dictionary.

GetValueOrDefault(TKey, TValue) GetValueOrDefault(TKey, TValue) GetValueOrDefault(TKey, TValue) GetValueOrDefault(TKey, TValue)

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。Gets the value for a given key if a matching key exists in the dictionary.

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

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

(Inherited from Object)
Remove(KeyValuePair<TKey,TValue>) Remove(KeyValuePair<TKey,TValue>) Remove(KeyValuePair<TKey,TValue>) Remove(KeyValuePair<TKey,TValue>)

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

Remove(TKey) Remove(TKey) Remove(TKey) Remove(TKey)

從不可變的字典中移除具有指定之索引鍵的項目。Removes the element with the specified key from the immutable dictionary.

RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>)

從不可變的字典中,移除索引鍵與可在指定順序中找到之索引鍵相符的任何項目。Removes any entries with keys that match those found in the specified sequence from the immutable dictionary.

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

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

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

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

(Inherited from Object)
TryGetKey(TKey, TKey) TryGetKey(TKey, TKey) TryGetKey(TKey, TKey) TryGetKey(TKey, TKey)

判斷此字典是否包含指定的索引鍵。Determines whether this dictionary contains a specified key.

TryGetValue(TKey, TValue) TryGetValue(TKey, TValue) TryGetValue(TKey, TValue) TryGetValue(TKey, TValue)

傳回與指定索引鍵相關聯的值。Returns the value associated with the specified key.

明確介面實作

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

從指定的陣列索引處開始,將字典的項目複製到 KeyValuePair<TKey,TValue> 類型的陣列。Copies the elements of the dictionary to an array of type KeyValuePair<TKey,TValue>, starting at the specified array index.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

取得值,這個值會指出 ICollection 的存取是否同步 (具備安全執行緒)。Gets a value that indicates whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

取得可用以同步存取 ICollection 的物件。Gets an object that can be used to synchronize access to the ICollection.

ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32) ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32) ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32) ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32)
ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly
IDictionary.Add(Object, Object) IDictionary.Add(Object, Object) IDictionary.Add(Object, Object) IDictionary.Add(Object, Object)

將具有所提供之索引鍵和值的項目加入字典物件。Adds an element with the provided key and value to the dictionary object.

IDictionary.Contains(Object) IDictionary.Contains(Object) IDictionary.Contains(Object) IDictionary.Contains(Object)

判斷字典物件是否包含具有指定索引鍵的項目。Determines whether the dictionary object contains an element with the specified key.

IDictionary.GetEnumerator() IDictionary.GetEnumerator() IDictionary.GetEnumerator() IDictionary.GetEnumerator()

傳回字典的 IDictionaryEnumerator 物件。Returns an IDictionaryEnumerator object for the dictionary.

IDictionary.IsFixedSize IDictionary.IsFixedSize IDictionary.IsFixedSize IDictionary.IsFixedSize

取得值,這個值會指出 IDictionary 物件的大小是否固定。Gets a value that indicates whether the IDictionary object has a fixed size.

IDictionary.IsReadOnly IDictionary.IsReadOnly IDictionary.IsReadOnly IDictionary.IsReadOnly

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

IDictionary.Item[Object] IDictionary.Item[Object] IDictionary.Item[Object] IDictionary.Item[Object]

取得或設定具有指定索引鍵的項目。Gets or sets the element with the specified key.

IDictionary.Keys IDictionary.Keys IDictionary.Keys IDictionary.Keys

取得 ICollection<T>,包含 IDictionary<TKey,TValue> 的索引鍵。Gets an ICollection<T> containing the keys of the IDictionary<TKey,TValue>.

IDictionary.Remove(Object) IDictionary.Remove(Object) IDictionary.Remove(Object) IDictionary.Remove(Object)

從字典中移除具有指定索引鍵的項目。Removes the element with the specified key from the dictionary.

IDictionary.Values IDictionary.Values IDictionary.Values IDictionary.Values

取得 ICollection<T>,包含 IDictionary<TKey,TValue> 中的值。Gets an ICollection<T> containing the values in the IDictionary<TKey,TValue>.

IDictionary<TKey,TValue>.Keys IDictionary<TKey,TValue>.Keys IDictionary<TKey,TValue>.Keys IDictionary<TKey,TValue>.Keys
IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values IDictionary<TKey,TValue>.Values
IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

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

IEnumerable<KeyValuePair<TKey,TValue>>.GetEnumerator() IEnumerable<KeyValuePair<TKey,TValue>>.GetEnumerator() IEnumerable<KeyValuePair<TKey,TValue>>.GetEnumerator() IEnumerable<KeyValuePair<TKey,TValue>>.GetEnumerator()

Extension Methods

GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey)
GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue)
Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)
TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)
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.

適用於