The original C# code according to the Reference Source is:
public override string ToString() {
StringBuilder s = StringBuilderCache.Acquire();
s.Append('[');
if( Key != null) {
s.Append(Key.ToString());
}
s.Append(", ");
if( Value != null) {
s.Append(Value.ToString());
}
s.Append(']');
return StringBuilderCache.GetStringAndRelease(s);
}
The IL code for the method according to ILspy is:
.method public hidebysig virtual
instance string ToString () cil managed
{
.custom instance void __DynamicallyInvokableAttribute::.ctor() = (
01 00 00 00
)
// Method begins at RVA 0x5f79c
// Code size 125 (0x7d)
.maxstack 2
.locals init (
[0] class System.Text.StringBuilder,
[1] !TKey,
[2] !TValue
)
IL_0000: ldc.i4.s 16
IL_0002: call class System.Text.StringBuilder System.Text.StringBuilderCache::Acquire(int32)
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.s 91
IL_000b: callvirt instance class System.Text.StringBuilder System.Text.StringBuilder::Append(char)
IL_0010: pop
IL_0011: ldarg.0
IL_0012: call instance !0 valuetype System.Collections.Generic.KeyValuePair`2<!TKey, !TValue>::get_Key()
IL_0017: box !TKey
IL_001c: brfalse.s IL_0039
IL_001e: ldloc.0
IL_001f: ldarg.0
IL_0020: call instance !0 valuetype System.Collections.Generic.KeyValuePair`2<!TKey, !TValue>::get_Key()
IL_0025: stloc.1
IL_0026: ldloca.s 1
IL_0028: constrained. !TKey
IL_002e: callvirt instance string System.Object::ToString()
IL_0033: callvirt instance class System.Text.StringBuilder System.Text.StringBuilder::Append(string)
IL_0038: pop
IL_0039: ldloc.0
IL_003a: ldstr ", "
IL_003f: callvirt instance class System.Text.StringBuilder System.Text.StringBuilder::Append(string)
IL_0044: pop
IL_0045: ldarg.0
IL_0046: call instance !1 valuetype System.Collections.Generic.KeyValuePair`2<!TKey, !TValue>::get_Value()
IL_004b: box !TValue
IL_0050: brfalse.s IL_006d
IL_0052: ldloc.0
IL_0053: ldarg.0
IL_0054: call instance !1 valuetype System.Collections.Generic.KeyValuePair`2<!TKey, !TValue>::get_Value()
IL_0059: stloc.2
IL_005a: ldloca.s 2
IL_005c: constrained. !TValue
IL_0062: callvirt instance string System.Object::ToString()
IL_0067: callvirt instance class System.Text.StringBuilder System.Text.StringBuilder::Append(string)
IL_006c: pop
IL_006d: ldloc.0
IL_006e: ldc.i4.s 93
IL_0070: callvirt instance class System.Text.StringBuilder System.Text.StringBuilder::Append(char)
IL_0075: pop
IL_0076: ldloc.0
IL_0077: call string System.Text.StringBuilderCache::GetStringAndRelease(class System.Text.StringBuilder)
IL_007c: ret
} // end of method KeyValuePair`2::ToString
As you can see, there is only one local variable of type StringBuilder.
The variables arg_33_0
and arg_67_0
are an artifact of the decompiler you're using; they're neither in the original C# code nor in the compiled IL code.