System.Collections.Generic.KeyValuePair<TKey,TValue>.ToString Method

Returns a string representation of the KeyValuePair`2, using the string representations of the key and value.

Syntax

public override string ToString ()

Returns

A string representation of the KeyValuePair`2, 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 KeyValuePair`2.ToString method for a KeyValuePair`2 structure with the string KeyValuePair`2.Key "Test" and the integer KeyValuePair`2.Value 14 returns the string "[Test, 14]".

Note:

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.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0