Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created February 14, 2013 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yetanotherchris/4952840 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4952840 to your computer and use it in GitHub Desktop.
IL for string.equals
IL_0000: nop
IL_0001: ldstr "Unicode text 1"
IL_0006: stloc.0
IL_0007: ldstr "Unicode text 2"
IL_000c: stloc.1
IL_000d: ldloc.0
IL_000e: ldloc.1
IL_000f: call bool [mscorlib]System.String::op_Equality(string,string)
IL_0014: ldc.i4.0
IL_0015: ceq
IL_0017: stloc.2
IL_0018: ldloc.2
IL_0019: brtrue.s IL_0026
IL_001b: ldstr "Equal from =="
IL_0020: call void [mscorlib]System.Console::WriteLine(string)
IL_0025: nop
IL_0026: ldloc.0
IL_0027: ldloc.1
IL_0028: callvirt instance bool [mscorlib]System.String::Equals(string)
IL_002d: ldc.i4.0
IL_002e: ceq
IL_0030: stloc.2
IL_0031: ldloc.2
IL_0032: brtrue.s IL_003f
IL_0034: ldstr "Equals from Equals()"
IL_0039: call void [mscorlib]System.Console::WriteLine(string)
IL_003e: nop
IL_003f: ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment