KeyValuePair<TKey,TValue>.ToString 方法

定义

使用键和值的字符串表示形式返回 KeyValuePair<TKey,TValue> 的字符串表示形式。Returns a string representation of the KeyValuePair<TKey,TValue>, using the string representations of the key and value.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

返回

String

KeyValuePair<TKey,TValue> 的字符串表示形式,它包括键和值的字符串表示形式。A string representation of the KeyValuePair<TKey,TValue>, which includes the string representations of the key and value.

注解

字符串表示形式包含键和值的字符串表示形式,用逗号和空格分隔,并用方括号括起来。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. 例如, ToString KeyValuePair<TKey,TValue> 使用字符串 Key "Test" 和整数14的结构的方法将 Value 返回字符串 "[test,14]"。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]".

备注

此方法使用 ToString 由键和值类型提供的方法。This method uses the ToString methods provided by the key and value types. 某些类型不会为其方法返回有用或信息性值 ToStringSome types do not return useful or informative values for their ToString methods.

适用于