Condividi tramite


IDictionary<TKey,TValue>.Values Proprietà

Definizione

Ottiene un oggetto ICollection<T> contenente i valori in IDictionary<TKey,TValue>.

public:
 property System::Collections::Generic::ICollection<TValue> ^ Values { System::Collections::Generic::ICollection<TValue> ^ get(); };
public System.Collections.Generic.ICollection<TValue> Values { get; }
member this.Values : System.Collections.Generic.ICollection<'Value>
Public ReadOnly Property Values As ICollection(Of TValue)

Valore della proprietà

ICollection<TValue>

Oggetto ICollection<T> contenente i valori nell'oggetto che implementa IDictionary<TKey,TValue>.

Esempio

Nell'esempio di codice seguente viene illustrato come enumerare solo i valori usando la Values proprietà .

Questo codice fa parte di un esempio più ampio che può essere compilato ed eseguito. Vedi System.Collections.Generic.IDictionary<TKey,TValue>.

// To get the values alone, use the Values property.
ICollection<string> icoll = openWith.Values;

// 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("Value = {0}", s);
}
' To get the values alone, use the Values property.
Dim icoll As ICollection(Of String) = openWith.Values

' 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("Value = {0}", s)
Next s

Commenti

L'ordine dei valori nell'oggetto restituito ICollection<T> non è specificato, ma è garantito che sia lo stesso ordine delle chiavi corrispondenti nell'oggetto ICollection<T> restituito dalla Keys proprietà .

Si applica a

Vedi anche