3 // Copyright (c) Microsoft Corporation. All rights reserved.
6 /*============================================================
8 ** Interface: KeyValuePair
10 ** <OWNER>[....]</OWNER>
13 ** Purpose: Generic key-value pair for dictionary enumerators.
16 ===========================================================*/
17 namespace System.Collections.Generic {
22 // A KeyValuePair holds a key and a value from a dictionary.
23 // It is used by the IEnumerable<T> implementation for both IDictionary<TKey, TValue>
24 // and IReadOnlyDictionary<TKey, TValue>.
26 public struct KeyValuePair<TKey, TValue> {
30 public KeyValuePair(TKey key, TValue value) {
43 public override string ToString() {
44 StringBuilder s = StringBuilderCache.Acquire();
47 s.Append(Key.ToString());
51 s.Append(Value.ToString());
54 return StringBuilderCache.GetStringAndRelease(s);