KeyValuePair<TKey,TValue>.Value Eigenschaft

Definition

Ruft den Wert im Schlüssel-Wert-Paar ab.

public:
 property TValue Value { TValue get(); };
public TValue Value { get; }
member this.Value : 'Value
Public ReadOnly Property Value As TValue

Eigenschaftswert

TValue

A TValue that is the value of the KeyValuePair<TKey,TValue>.

Beispiele

Im folgenden Codebeispiel wird gezeigt, wie Sie die Schlüssel und Werte in einem Wörterbuch mithilfe der KeyValuePair<TKey,TValue> Struktur aufzählen.

Dieser Code ist Teil eines größeren Beispiels, das für die Dictionary<TKey,TValue> Klasse bereitgestellt wird.

// When you use foreach to enumerate dictionary elements,
// the elements are retrieved as KeyValuePair objects.
Console.WriteLine();
foreach( KeyValuePair<string, string> kvp in openWith )
{
    Console.WriteLine("Key = {0}, Value = {1}",
        kvp.Key, kvp.Value);
}
' When you use foreach to enumerate dictionary elements,
' the elements are retrieved as KeyValuePair objects.
Console.WriteLine()
For Each kvp As KeyValuePair(Of String, String) In openWith
    Console.WriteLine("Key = {0}, Value = {1}", _
        kvp.Key, kvp.Value)
Next kvp

Hinweise

Diese Eigenschaft ist schreibgeschützt.

Gilt für: