IDictionary<TKey,TValue>.Values Properti

Definisi

Mendapatkan yang ICollection<T> berisi nilai dalam 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)

Nilai Properti

ICollection<TValue>

yang ICollection<T> berisi nilai dalam objek yang mengimplementasikan IDictionary<TKey,TValue>.

Contoh

Contoh kode berikut menunjukkan cara menghitung nilai saja menggunakan Values properti .

Kode ini adalah bagian dari contoh yang lebih besar yang dapat dikompilasi dan dijalankan. Lihat 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();
for each( String^ s in icoll )
{
    Console::WriteLine("Value = {0}", s);
}
// 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

Keterangan

Urutan nilai dalam yang dikembalikan ICollection<T> tidak ditentukan, tetapi dijamin urutannya sama dengan kunci yang sesuai dalam ICollection<T> yang dikembalikan oleh Keys properti .

Berlaku untuk

Lihat juga