IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> Interface

定義

表示索引鍵/值組的不可變集合。Represents an immutable collection of key/value pairs.

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

generic <typename TKey, typename TValue>
public interface class IImmutableDictionary : 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>
public interface IImmutableDictionary<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>
type IImmutableDictionary<'Key, 'Value> = interface
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
    interface IReadOnlyCollection<KeyValuePair<'Key, 'Value>>
    interface IReadOnlyDictionary<'Key, 'Value>
Public Interface IImmutableDictionary(Of TKey, TValue)
Implements IEnumerable(Of KeyValuePair(Of TKey, TValue)), IReadOnlyCollection(Of KeyValuePair(Of TKey, TValue)), IReadOnlyDictionary(Of TKey, TValue)

類型參數

TKey

字典中之索引鍵的類型。The type of keys in the dictionary.

TValue

字典中之值的類型。The type of values in the dictionary.

衍生
實作

備註

AIImmutableDictionary<TKey,TValue>需要判斷兩個索引鍵是否相等的相等比較子實作。A IImmutableDictionary<TKey,TValue> requires an equality comparer implementation to determine if two keys are equal.

方法

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

將具有指定之索引鍵和值的項目加入至字典。Adds an element with the specified key and value to the dictionary.

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

將指定的索引鍵/值組加入至字典中。Adds the specified key/value pairs to the dictionary.

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

擷取空字典,其具有與字典執行個體相同的順序和索引鍵/值比較規則。Retrieves an empty dictionary that has the same ordering and key/value comparison rules as this dictionary instance.

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

判斷此不可變的字典是否包含指定的索引鍵/值組。Determines whether the immutable dictionary contains the specified key/value pair.

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

判斷唯讀字典是否包含具有指定索引鍵的項目。Determines whether the read-only dictionary contains an element that has the specified key.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

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

(Inherited from IEnumerable)
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 the elements with the specified keys from the immutable dictionary.

SetItem(TKey, TValue) SetItem(TKey, TValue) SetItem(TKey, TValue) SetItem(TKey, TValue)

設定不可變字典中指定的索引鍵和值,可能會覆寫索引鍵的現有值。Sets the specified key and value in the immutable dictionary, possibly overwriting an existing value for the key.

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

設定不可變字典中指定的索引鍵/值組,可能會覆寫索引鍵的現有值。Sets the specified key/value pairs in the immutable dictionary, possibly overwriting existing values for the keys.

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)

取得與指定之索引鍵相關聯的值。Gets the value that is associated with the specified key.

(Inherited from IReadOnlyDictionary<TKey,TValue>)

屬性

Count Count Count Count

取得集合中的項目數。Gets the number of elements in the collection.

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

取得在唯讀字典中擁有指定索引鍵的項目。Gets the element that has the specified key in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
Keys Keys Keys Keys

取得可列舉集合,其中包含唯讀字典中的索引鍵。Gets an enumerable collection that contains the keys in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
Values Values Values Values

取得可列舉集合,其中包含唯讀字典中的值。Gets an enumerable collection that contains the values in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)

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)
Contains<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) Contains<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) Contains<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) Contains<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue)

判斷指定的不可變字典是否包含指定的索引鍵/值組。Determines whether the specified immutable dictionary contains the specified key/value pair.

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey)

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

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue)

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

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.

適用於