KeyValuePair<TKey,TValue>.ToString 方法

定義

使用索引鍵和值的字串表示,傳回 KeyValuePair<TKey,TValue> 的字串表示。

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

傳回

KeyValuePair<TKey,TValue> 的字串表示,包含索引鍵和值的字串表示。

備註

字串表示包含索引鍵和值的字串表示,並以逗號和空格分隔,並以方括弧括住。 例如,ToString具有字串 Key 「Test」 且整數 Value 14 的結構方法KeyValuePair<TKey,TValue>會傳回字串 “[Test, 14]”。

注意

這個方法會使用 ToString 索引鍵和實值型別所提供的方法。 某些類型不會傳回其 ToString 方法的實用值或資訊值。

適用於