IDictionary<TKey,TValue>.Keys Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
ICollection<T> Získá obsahující klíče IDictionary<TKey,TValue>.
public:
property System::Collections::Generic::ICollection<TKey> ^ Keys { System::Collections::Generic::ICollection<TKey> ^ get(); };
public System.Collections.Generic.ICollection<TKey> Keys { get; }
member this.Keys : System.Collections.Generic.ICollection<'Key>
Public ReadOnly Property Keys As ICollection(Of TKey)
Hodnota vlastnosti
Obsahující ICollection<T> klíče objektu, který implementuje IDictionary<TKey,TValue>.
Příklady
Následující příklad kódu ukazuje, jak vytvořit výčet klíčů samostatně pomocí Keys vlastnosti.
Tento kód je součástí většího příkladu, který lze zkompilovat a spustit. Viz System.Collections.Generic.IDictionary<TKey,TValue>.
// To get the keys alone, use the Keys property.
icoll = openWith.Keys;
// The elements of the ValueCollection are strongly typed
// with the type that was specified for dictionary values.
Console.WriteLine();
foreach( string s in icoll )
{
Console.WriteLine("Key = {0}", s);
}
' To get the keys alone, use the Keys property.
icoll = openWith.Keys
' The elements of the ValueCollection are strongly typed
' with the type that was specified for dictionary values.
Console.WriteLine()
For Each s As String In icoll
Console.WriteLine("Key = {0}", s)
Next s
Poznámky
Pořadí vrácených klíčů ICollection<T> není zadané, ale zaručuje se, že bude stejné pořadí jako odpovídající hodnoty ICollection<T> vrácené Values vlastností.