Dictionary<TKey,TValue>.KeyCollection クラス
定義
Dictionary<TKey,TValue> 内のキーのコレクションを表します。Represents the collection of keys in a Dictionary<TKey,TValue>. このクラスは継承できません。This class cannot be inherited.
public: ref class Dictionary<TKey, TValue>::KeyCollection sealed : System::Collections::Generic::ICollection<TKey>, System::Collections::Generic::IEnumerable<TKey>, System::Collections::Generic::IReadOnlyCollection<TKey>, System::Collections::ICollection
[System.Serializable]
public sealed class Dictionary<TKey,TValue>.KeyCollection : System.Collections.Generic.ICollection<TKey>, System.Collections.Generic.IEnumerable<TKey>, System.Collections.Generic.IReadOnlyCollection<TKey>, System.Collections.ICollection
type Dictionary<'Key, 'Value>.KeyCollection = class
interface ICollection<'Key>
interface ICollection
interface IReadOnlyCollection<'Key>
interface seq<'Key>
interface IEnumerable
Public NotInheritable Class Dictionary(Of TKey, TValue).KeyCollection
Implements ICollection, ICollection(Of TKey), IEnumerable(Of TKey), IReadOnlyCollection(Of TKey)
型パラメーター
- TKey
- TValue
- 継承
-
Dictionary<TKey,TValue>.KeyCollection
- 属性
- 実装
-
ICollection<TKey> IEnumerable<T> IEnumerable<TKey> IReadOnlyCollection<TKey> ICollection IEnumerable
注釈
プロパティDictionary<TKey,TValue>.Keysは、 Dictionary<TKey,TValue>内のすべてのキーを含む、この型のインスタンスを返します。The Dictionary<TKey,TValue>.Keys property returns an instance of this type, containing all the keys in that Dictionary<TKey,TValue>. 内Dictionary<TKey,TValue>.KeyCollectionのキーの順序は指定されていませんが、 Dictionary<TKey,TValue>.ValuesプロパティによってDictionary<TKey,TValue>.ValueCollection返される内の関連付けられた値と同じ順序になります。The order of the keys in the Dictionary<TKey,TValue>.KeyCollection is unspecified, but it is the same order as the associated values in the Dictionary<TKey,TValue>.ValueCollection returned by the Dictionary<TKey,TValue>.Values property.
は静的なコピーでDictionary<TKey,TValue>.KeyCollection Dictionary<TKey,TValue>はなく、は元ののキーを参照します。 Dictionary<TKey,TValue>.KeyCollectionThe Dictionary<TKey,TValue>.KeyCollection is not a static copy; instead, the Dictionary<TKey,TValue>.KeyCollection refers back to the keys in the original Dictionary<TKey,TValue>. したがって、へDictionary<TKey,TValue>の変更は、 Dictionary<TKey,TValue>.KeyCollection引き続きに反映されます。Therefore, changes to the Dictionary<TKey,TValue> continue to be reflected in the Dictionary<TKey,TValue>.KeyCollection.
コンストラクター
Dictionary<TKey,TValue>.KeyCollection(Dictionary<TKey,TValue>) |
指定した Dictionary<TKey,TValue>.KeyCollection 内のキーを反映する、Dictionary<TKey,TValue> クラスの新しいインスタンスを初期化します。Initializes a new instance of the Dictionary<TKey,TValue>.KeyCollection class that reflects the keys in the specified Dictionary<TKey,TValue>. |
プロパティ
Count |
Dictionary<TKey,TValue>.KeyCollection に格納されている要素の数を取得します。Gets the number of elements contained in the Dictionary<TKey,TValue>.KeyCollection. |
メソッド
CopyTo(TKey[], Int32) |
Dictionary<TKey,TValue>.KeyCollection の要素を既存の 1 次元の Array にコピーします。コピー操作は、配列内の指定したインデックスから始まります。Copies the Dictionary<TKey,TValue>.KeyCollection elements to an existing one-dimensional Array, starting at the specified array index. |
Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判定します。Determines whether the specified object is equal to the current object. (継承元 Object) |
GetEnumerator() |
Dictionary<TKey,TValue>.KeyCollection を反復処理する列挙子を返します。Returns an enumerator that iterates through the Dictionary<TKey,TValue>.KeyCollection. |
GetHashCode() |
既定のハッシュ関数として機能します。Serves as the default hash function. (継承元 Object) |
GetType() |
現在のインスタンスの Type を取得します。Gets the Type of the current instance. (継承元 Object) |
MemberwiseClone() |
現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object. (継承元 Object) |
ToString() |
現在のオブジェクトを表す string を返します。Returns a string that represents the current object. (継承元 Object) |
明示的なインターフェイスの実装
ICollection.CopyTo(Array, Int32) |
ICollection の要素を Array にコピーします。Array の特定のインデックスからコピーが開始されます。Copies the elements of the ICollection to an Array, starting at a particular Array index. |
ICollection.IsSynchronized |
ICollection へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。Gets a value indicating 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<TKey>.Add(TKey) |
ICollection<T> に項目を追加します。Adds an item to the ICollection<T>. この実装は常に NotSupportedException をスローします。This implementation always throws NotSupportedException. |
ICollection<TKey>.Clear() |
ICollection<T> からすべての項目を削除します。Removes all items from the ICollection<T>. この実装は常に NotSupportedException をスローします。This implementation always throws NotSupportedException. |
ICollection<TKey>.Contains(TKey) |
ICollection<T> に特定の値が格納されているかどうかを判断します。Determines whether the ICollection<T> contains a specific value. |
ICollection<TKey>.IsReadOnly |
ICollection<T> が読み取り専用かどうかを示す値を取得します。Gets a value indicating whether the ICollection<T> is read-only. |
ICollection<TKey>.Remove(TKey) |
特定のオブジェクトが ICollection<T> 内にあるときに、最初に出現したものを削除します。Removes the first occurrence of a specific object from the ICollection<T>. この実装は常に NotSupportedException をスローします。This implementation always throws NotSupportedException. |
IEnumerable.GetEnumerator() |
コレクションを反復処理する列挙子を返します。Returns an enumerator that iterates through a collection. |
IEnumerable<TKey>.GetEnumerator() |
コレクションを反復処理する列挙子を返します。Returns an enumerator that iterates through a collection. |
拡張メソッド
CopyToDataTable<T>(IEnumerable<T>) |
指定した入力 DataTable オブジェクトに応じて (ジェネリック パラメーター |
CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) |
指定した入力 DataRow オブジェクトに応じて (ジェネリック パラメーター |
CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) |
指定した入力 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 を IQueryable に変換します。Converts 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. |
適用対象
スレッド セーフ
パブリック静的 (Visual Basic ではShared
) なこの型のメンバーはスレッド セーフですPublic static (Shared
in Visual Basic) members of this type are thread safe. インスタンス メンバーの場合は、スレッド セーフであるとは限りません。Any instance members are not guaranteed to be thread safe.
はDictionary<TKey,TValue>.KeyCollection 、コレクションが変更されていない限り、複数のリーダーを同時にサポートできます。A Dictionary<TKey,TValue>.KeyCollection can support multiple readers concurrently, as long as the collection is not modified. それでも、コレクションを列挙することは、本質的にはスレッドセーフなプロシージャではありません。Even so, enumerating through a collection is intrinsically not a thread-safe procedure. 列挙処理でスレッド セーフを確保するために、列挙処理が終わるまでコレクションをロックできます。To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. コレクションに対し複数のスレッドがアクセスして読み取りや書き込みを行うことができるようにするには、独自に同期化を実装する必要があります。To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.