KeyValuePair<TKey, TValue>.Value Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets the value in the key/value pair.
Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public ReadOnly Property Value As TValue
public TValue Value { get; }
Property Value
Type: TValue
A TValue that is the value of the KeyValuePair<TKey, TValue>.
Remarks
This property is read/only.
Examples
The following code example shows how to enumerate the keys and values in a dictionary, using the KeyValuePair<TKey, TValue> structure.
This code is part of a larger example provided for the Dictionary<TKey, TValue> class.
' When you use foreach to enumerate dictionary elements,
' the elements are retrieved as KeyValuePair objects.
outputBlock.Text &= vbCrLf
For Each kvp As KeyValuePair(Of String, String) In openWith
outputBlock.Text &= String.Format("Key = {0}, Value = {1}", _
kvp.Key, kvp.Value) & vbCrLf
Next kvp
// When you use foreach to enumerate dictionary elements,
// the elements are retrieved as KeyValuePair objects.
outputBlock.Text += "\n";
foreach (KeyValuePair<string, string> kvp in openWith)
{
outputBlock.Text += String.Format("Key = {0}, Value = {1}",
kvp.Key, kvp.Value) + "\n";
}
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.