KeyValuePair<TKey,TValue>.Value 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得鍵值對的值。
public:
property TValue Value { TValue get(); };
public TValue Value { get; }
member this.Value : 'Value
Public ReadOnly Property Value As TValue
屬性值
TValue
A TValue 是 的 KeyValuePair<TKey,TValue>值。
範例
以下程式碼範例說明如何使用結構在字典 KeyValuePair<TKey,TValue> 中枚舉鍵與值。
此程式碼是該類別更大 Dictionary<TKey,TValue> 範例的一部分。
// 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
備註
此屬性為僅讀。