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

傳回

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. 例如,具有字串 Key "Test" 且整數 Value 14 的 KeyValuePair<TKey,TValue> 結構的 ToString 方法會傳回字串 "[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. 某些類型不會針對其 ToString 方法傳回有用或資訊性的值。Some types do not return useful or informative values for their ToString methods.

適用於