IDictionary<TKey,TValue>.Keys Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém um ICollection<T> contendo as chaves do 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)
Valor de Propriedade
An ICollection<T> contendo as chaves do objeto que implementa IDictionary<TKey,TValue>.
Exemplos
O exemplo de código seguinte mostra como enumerar chaves sozinho usando a Keys propriedade.
Este código faz parte de um exemplo maior que pode ser compilado e executado. Consulte 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
Observações
A ordem das chaves no retorno ICollection<T> não é especificada, mas é garantido que seja a mesma ordem dos valores correspondentes no ICollection<T> retorno pela Values propriedade.