KeyValuePair<TKey, TValue>.ToString Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a string representation of the KeyValuePair<TKey, TValue>, using the string representations of the key and value.

Namespace:  System.Collections.Generic
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overrides Function ToString As String
public override string ToString()

Return Value

Type: System.String
A string representation of the KeyValuePair<TKey, TValue>, which includes the string representations of the key and value.

Remarks

The string representation consists of the string representations of the key and value, separated by a comma and a space, and enclosed in square brackets. For example, the ToString method for a KeyValuePair<TKey, TValue> structure with the string Key "Test" and the integer Value 14 returns the string "[Test, 14]".

NoteNote:

This method uses the ToString methods provided by the key and value types. Some types do not return useful or informative values for their ToString methods.

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.