Skip to content

Instantly share code, notes, and snippets.

@fekberg
Created September 19, 2012 18:06
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 fekberg/3751194 to your computer and use it in GitHub Desktop.
Save fekberg/3751194 to your computer and use it in GitHub Desktop.
IL
--- Using temporary list --
GetList:
IL_0000: nop
IL_0001: newobj System.Collections.Generic.List<System.String>..ctor
IL_0006: stloc.0
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldfld UserQuery._names
IL_000E: callvirt System.Collections.Generic.IEnumerable<System.String>.GetEnumerator
IL_0013: stloc.3
IL_0014: br.s IL_0039
IL_0016: ldloc.3
IL_0017: callvirt System.Collections.Generic.IEnumerator<System.String>.get_Current
IL_001C: stloc.1
IL_001D: nop
IL_001E: ldloc.1
IL_001F: ldarg.1
IL_0020: callvirt System.String.Contains
IL_0025: ldc.i4.0
IL_0026: ceq
IL_0028: stloc.s 04
IL_002A: ldloc.s 04
IL_002C: brtrue.s IL_0038
IL_002E: nop
IL_002F: ldloc.0
IL_0030: ldloc.1
IL_0031: callvirt System.Collections.Generic.List<System.String>.Add
IL_0036: nop
IL_0037: nop
IL_0038: nop
IL_0039: ldloc.3
IL_003A: callvirt System.Collections.IEnumerator.MoveNext
IL_003F: stloc.s 04
IL_0041: ldloc.s 04
IL_0043: brtrue.s IL_0016
IL_0045: leave.s IL_0059
IL_0047: ldloc.3
IL_0048: ldnull
IL_0049: ceq
IL_004B: stloc.s 04
IL_004D: ldloc.s 04
IL_004F: brtrue.s IL_0058
IL_0051: ldloc.3
IL_0052: callvirt System.IDisposable.Dispose
IL_0057: nop
IL_0058: endfinally
IL_0059: nop
IL_005A: ldloc.0
IL_005B: stloc.2
IL_005C: br.s IL_005E
IL_005E: ldloc.2
IL_005F: ret
--- Using yield --
GetList:
IL_0000: ldc.i4.s FE
IL_0002: newobj UserQuery+<GetList>d__0..ctor
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldarg.0
IL_000A: stfld UserQuery+<GetList>d__0.<>4__this
IL_000F: ldloc.0
IL_0010: ldarg.1
IL_0011: stfld UserQuery+<GetList>d__0.<>3__pattern
IL_0016: ldloc.0
IL_0017: stloc.1
IL_0018: br.s IL_001A
IL_001A: ldloc.1
IL_001B: ret
<GetList>d__0.System.Collections.Generic.IEnumerable<System.String>.GetEnumerator:
IL_0000: call System.Environment.get_CurrentManagedThreadId
IL_0005: ldarg.0
IL_0006: ldfld UserQuery+<GetList>d__0.<>l__initialThreadId
IL_000B: bne.un.s IL_001C
IL_000D: ldarg.0
IL_000E: ldfld UserQuery+<GetList>d__0.<>1__state
IL_0013: ldc.i4.s FE
IL_0015: ceq
IL_0017: ldc.i4.0
IL_0018: ceq
IL_001A: br.s IL_001D
IL_001C: ldc.i4.1
IL_001D: nop
IL_001E: stloc.2
IL_001F: ldloc.2
IL_0020: brtrue.s IL_002D
IL_0022: ldarg.0
IL_0023: ldc.i4.0
IL_0024: stfld UserQuery+<GetList>d__0.<>1__state
IL_0029: ldarg.0
IL_002A: stloc.0
IL_002B: br.s IL_0040
IL_002D: ldc.i4.0
IL_002E: newobj UserQuery+<GetList>d__0..ctor
IL_0033: stloc.0
IL_0034: ldloc.0
IL_0035: ldarg.0
IL_0036: ldfld UserQuery+<GetList>d__0.<>4__this
IL_003B: stfld UserQuery+<GetList>d__0.<>4__this
IL_0040: ldloc.0
IL_0041: ldarg.0
IL_0042: ldfld UserQuery+<GetList>d__0.<>3__pattern
IL_0047: stfld UserQuery+<GetList>d__0.pattern
IL_004C: ldloc.0
IL_004D: stloc.1
IL_004E: br.s IL_0050
IL_0050: ldloc.1
IL_0051: ret
<GetList>d__0.System.Collections.IEnumerable.GetEnumerator:
IL_0000: ldarg.0
IL_0001: call UserQuery+<GetList>d__0.System.Collections.Generic.IEnumerable<System.String>.GetEnumerator
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000A: ret
<GetList>d__0.MoveNext:
IL_0000: ldarg.0
IL_0001: ldfld UserQuery+<GetList>d__0.<>1__state
IL_0006: stloc.1
IL_0007: ldloc.1
IL_0008: switch (IL_001D, IL_001F, IL_001B)
IL_0019: br.s IL_001F
IL_001B: br.s IL_008E
IL_001D: br.s IL_0024
IL_001F: br IL_00AE
IL_0024: ldarg.0
IL_0025: ldc.i4.m1
IL_0026: stfld UserQuery+<GetList>d__0.<>1__state
IL_002B: nop
IL_002C: nop
IL_002D: ldarg.0
IL_002E: ldarg.0
IL_002F: ldfld UserQuery+<GetList>d__0.<>4__this
IL_0034: ldfld UserQuery._names
IL_0039: callvirt System.Collections.Generic.IEnumerable<System.String>.GetEnumerator
IL_003E: stfld UserQuery+<GetList>d__0.<>7__wrap2
IL_0043: ldarg.0
IL_0044: ldc.i4.1
IL_0045: stfld UserQuery+<GetList>d__0.<>1__state
IL_004A: br.s IL_0097
IL_004C: ldarg.0
IL_004D: ldarg.0
IL_004E: ldfld UserQuery+<GetList>d__0.<>7__wrap2
IL_0053: callvirt System.Collections.Generic.IEnumerator<System.String>.get_Current
IL_0058: stfld UserQuery+<GetList>d__0.<name>5__1
IL_005D: nop
IL_005E: ldarg.0
IL_005F: ldfld UserQuery+<GetList>d__0.<name>5__1
IL_0064: ldarg.0
IL_0065: ldfld UserQuery+<GetList>d__0.pattern
IL_006A: callvirt System.String.Contains
IL_006F: ldc.i4.0
IL_0070: ceq
IL_0072: stloc.2
IL_0073: ldloc.2
IL_0074: brtrue.s IL_0096
IL_0076: nop
IL_0077: ldarg.0
IL_0078: ldarg.0
IL_0079: ldfld UserQuery+<GetList>d__0.<name>5__1
IL_007E: stfld UserQuery+<GetList>d__0.<>2__current
IL_0083: ldarg.0
IL_0084: ldc.i4.2
IL_0085: stfld UserQuery+<GetList>d__0.<>1__state
IL_008A: ldc.i4.1
IL_008B: stloc.0
IL_008C: leave.s IL_00BA
IL_008E: ldarg.0
IL_008F: ldc.i4.1
IL_0090: stfld UserQuery+<GetList>d__0.<>1__state
IL_0095: nop
IL_0096: nop
IL_0097: ldarg.0
IL_0098: ldfld UserQuery+<GetList>d__0.<>7__wrap2
IL_009D: callvirt System.Collections.IEnumerator.MoveNext
IL_00A2: stloc.2
IL_00A3: ldloc.2
IL_00A4: brtrue.s IL_004C
IL_00A6: ldarg.0
IL_00A7: call UserQuery+<GetList>d__0.<>m__Finally3
IL_00AC: nop
IL_00AD: nop
IL_00AE: ldc.i4.0
IL_00AF: stloc.0
IL_00B0: leave.s IL_00BA
IL_00B2: ldarg.0
IL_00B3: call UserQuery+<GetList>d__0.System.IDisposable.Dispose
IL_00B8: nop
IL_00B9: endfinally
IL_00BA: nop
IL_00BB: ldloc.0
IL_00BC: ret
<GetList>d__0.System.Collections.Generic.IEnumerator<System.String>.get_Current:
IL_0000: ldarg.0
IL_0001: ldfld UserQuery+<GetList>d__0.<>2__current
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000A: ret
<GetList>d__0.System.Collections.IEnumerator.Reset:
IL_0000: newobj System.NotSupportedException..ctor
IL_0005: throw
<GetList>d__0.System.IDisposable.Dispose:
IL_0000: ldarg.0
IL_0001: ldfld UserQuery+<GetList>d__0.<>1__state
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.1
IL_0009: sub
IL_000A: switch (IL_001B, IL_0019)
IL_0017: br.s IL_001D
IL_0019: br.s IL_001F
IL_001B: br.s IL_001F
IL_001D: br.s IL_002A
IL_001F: leave.s IL_0029
IL_0021: ldarg.0
IL_0022: call UserQuery+<GetList>d__0.<>m__Finally3
IL_0027: nop
IL_0028: endfinally
IL_0029: nop
IL_002A: ret
<GetList>d__0.System.Collections.IEnumerator.get_Current:
IL_0000: ldarg.0
IL_0001: ldfld UserQuery+<GetList>d__0.<>2__current
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000A: ret
<GetList>d__0.<>m__Finally3:
IL_0000: ldarg.0
IL_0001: ldc.i4.m1
IL_0002: stfld UserQuery+<GetList>d__0.<>1__state
IL_0007: ldarg.0
IL_0008: ldfld UserQuery+<GetList>d__0.<>7__wrap2
IL_000D: ldnull
IL_000E: ceq
IL_0010: stloc.0
IL_0011: ldloc.0
IL_0012: brtrue.s IL_0020
IL_0014: ldarg.0
IL_0015: ldfld UserQuery+<GetList>d__0.<>7__wrap2
IL_001A: callvirt System.IDisposable.Dispose
IL_001F: nop
IL_0020: ret
<GetList>d__0..ctor:
IL_0000: ldarg.0
IL_0001: call System.Object..ctor
IL_0006: ldarg.0
IL_0007: ldarg.1
IL_0008: stfld UserQuery+<GetList>d__0.<>1__state
IL_000D: ldarg.0
IL_000E: call System.Environment.get_CurrentManagedThreadId
IL_0013: stfld UserQuery+<GetList>d__0.<>l__initialThreadId
IL_0018: ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment