Example 1: IL Disassembly of GetNewName
method private hidebysig instance string GetNewString(string currentString, int32 requiredLength) cil managed { // Code size 94 (0x5e) .maxstack 3 .locals (int32 V_0) IL_0000: ldarg.2 IL_0001: ldc.i4.1 IL_0002: add IL_0003: starg.s requiredLength IL_0005: ldarg.2 IL_0006: ldarg.0 IL_0007: ldfld int32 System.Text.StringBuilder::m_MaxCapacity IL_000c: ble.s IL_0023 IL_000e: ldstr "ArgumentOutOfRange_NegativeCapacity" IL_0013: call string System.Environment::GetResourceString (string) IL_0018: ldstr "requiredLength" IL_001d: newobj instance void System.ArgumentOutOfRangeException::.ctor(string, string) IL_0022: throw IL_0023: ldarg.1 IL_0024: callvirt instance int32 System.String::get_Capacity() IL_0029: ldc.i4.2 IL_002a: mul IL_002b: stloc.0 IL_002c: ldloc.0 IL_002d: ldarg.2 IL_002e: bge.s IL_0032 IL_0030: ldarg.2 IL_0031: stloc.0 IL_0032: ldloc.0 IL_0033: ldarg.0 IL_0034: ldfld int32 System.Text.StringBuilder::m_MaxCapacity IL_0039: ble.s IL_0042 IL_003b: ldarg.0 IL_003c: ldfld int32 System.Text.StringBuilder::m_MaxCapacity IL_0041: stloc.0 IL_0042: ldloc.0 IL_0043: ldc.i4.0 IL_0044: bgt.s IL_0056 IL_0046: ldstr "ArgumentOutOfRange_NegativeCapacity" IL_004b: call string System.Environment::GetResourceString(string) IL_0050: newobj instance void System.ArgumentOutOfRangeException::.ctor(string) IL_0055: throw IL_0056: ldarg.1 IL_0057: ldloc.0 IL_0058: call string System.String::GetStringForStringBuilder(string, int32) IL_005d: ret } // end of method StringBuilder::GetNewString