Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

monodis for enumerables

View test.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
using System.Collections.Generic;
 
public class Program
{
public static IEnumerable<int> UsingYield()
{
yield return 42;
}
public static IEnumerable<int> ReturningArray()
{
return new []{ 42 };
}
 
public static void Main(string[] args) {}
}
View test.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
.assembly extern mscorlib
{
.ver 4:0:0:0
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly 'test'
{
.custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
 
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module test.exe // GUID = {999C8256-8C09-4C29-ADFC-CCE578327698}
 
 
.class public auto ansi beforefieldinit Program
extends [mscorlib]System.Object
{
 
// method line 1
.method public hidebysig specialname rtspecialname
instance default void '.ctor' () cil managed
{
// Method begins at RVA 0x20ec
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void object::'.ctor'()
IL_0006: ret
} // end of method Program::.ctor
 
// method line 2
.method public static hidebysig
default class [mscorlib]System.Collections.Generic.IEnumerable`1<int32> UsingYield () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x20f4
// Code size 16 (0x10)
.maxstack 3
.locals init (
class Program/'<UsingYield>c__Iterator0' V_0)
IL_0000: newobj instance void class Program/'<UsingYield>c__Iterator0'::'.ctor'()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: dup
IL_0008: ldc.i4.s 0xfffffffe
IL_000a: stfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_000f: ret
} // end of method Program::UsingYield
 
// method line 3
.method public static hidebysig
default class [mscorlib]System.Collections.Generic.IEnumerable`1<int32> ReturningArray () cil managed
{
// Method begins at RVA 0x2110
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: ldc.i4.s 0x2a
IL_000a: stelem.i4
IL_000b: ret
} // end of method Program::ReturningArray
 
// method line 4
.method public static hidebysig
default void Main (string[] args) cil managed
{
// Method begins at RVA 0x2120
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Program::Main
 
.class nested private auto ansi sealed beforefieldinit '<UsingYield>c__Iterator0'
extends [mscorlib]System.Object
implements class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>, class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>, [mscorlib]System.Collections.IEnumerable, [mscorlib]System.Collections.IEnumerator, [mscorlib]System.IDisposable {
.custom instance void class [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
.field assembly int32 $PC
.field assembly int32 $current
 
// method line 5
.method public hidebysig specialname rtspecialname
instance default void '.ctor' () cil managed
{
// Method begins at RVA 0x2124
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void object::'.ctor'()
IL_0006: ret
} // end of method <UsingYield>c__Iterator0::.ctor
 
// method line 6
.method private final virtual hidebysig newslot specialname
instance default int32 'System.Collections.Generic.IEnumerator<int>.get_Current' () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x212c
.override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>::get_Current()
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 Program/'<UsingYield>c__Iterator0'::$current
IL_0006: ret
} // end of method <UsingYield>c__Iterator0::System.Collections.Generic.IEnumerator<int>.get_Current
 
// method line 7
.method private final virtual hidebysig newslot specialname
instance default object System.Collections.IEnumerator.get_Current () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x2134
.override class [mscorlib]System.Collections.IEnumerator::get_Current
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 Program/'<UsingYield>c__Iterator0'::$current
IL_0006: box [mscorlib]System.Int32
IL_000b: ret
} // end of method <UsingYield>c__Iterator0::System.Collections.IEnumerator.get_Current
 
// method line 8
.method private final virtual hidebysig newslot
instance default class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed
{
// Method begins at RVA 0x2144
.override class [mscorlib]System.Collections.IEnumerable::GetEnumerator
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> class Program/'<UsingYield>c__Iterator0'::'System.Collections.Generic.IEnumerable<int>.GetEnumerator'()
IL_0006: ret
} // end of method <UsingYield>c__Iterator0::System.Collections.IEnumerable.GetEnumerator
 
// method line 9
.method private final virtual hidebysig newslot
instance default class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> 'System.Collections.Generic.IEnumerable<int>.GetEnumerator' () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x214c
.override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>::GetEnumerator()
// Code size 26 (0x1a)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_0006: ldc.i4.0
IL_0007: ldc.i4.s 0xfffffffe
IL_0009: call int32 class [mscorlib]System.Threading.Interlocked::CompareExchange([out] int32&, int32, int32)
IL_000e: ldc.i4.s 0xfffffffe
IL_0010: bne.un.s IL_0014
 
IL_0012: ldarg.0
IL_0013: ret
IL_0014: newobj instance void class Program/'<UsingYield>c__Iterator0'::'.ctor'()
IL_0019: ret
} // end of method <UsingYield>c__Iterator0::System.Collections.Generic.IEnumerable<int>.GetEnumerator
 
// method line 10
.method public final virtual hidebysig newslot
instance default bool MoveNext () cil managed
{
// Method begins at RVA 0x2168
// Code size 64 (0x40)
.maxstack 2
.locals init (
unsigned int32 V_0)
IL_0000: ldarg.0
IL_0001: ldfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_0006: stloc.0
IL_0007: ldarg.0
IL_0008: ldc.i4.m1
IL_0009: stfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_000e: ldloc.0
IL_000f: switch (
IL_0021,
IL_0035)
IL_001c: br IL_003c
 
IL_0021: ldarg.0
IL_0022: ldc.i4.s 0x2a
IL_0024: stfld int32 Program/'<UsingYield>c__Iterator0'::$current
IL_0029: ldarg.0
IL_002a: ldc.i4.1
IL_002b: stfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_0030: br IL_003e
 
IL_0035: ldarg.0
IL_0036: ldc.i4.m1
IL_0037: stfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_003c: ldc.i4.0
IL_003d: ret
IL_003e: ldc.i4.1
IL_003f: ret
} // end of method <UsingYield>c__Iterator0::MoveNext
 
// method line 11
.method public final virtual hidebysig newslot
instance default void Dispose () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x21b4
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.m1
IL_0002: stfld int32 Program/'<UsingYield>c__Iterator0'::$PC
IL_0007: ret
} // end of method <UsingYield>c__Iterator0::Dispose
 
// method line 12
.method public final virtual hidebysig newslot
instance default void Reset () cil managed
{
.custom instance void class [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::'.ctor'() = (01 00 00 00 ) // ....
 
// Method begins at RVA 0x21c0
// Code size 6 (0x6)
.maxstack 8
IL_0000: newobj instance void class [mscorlib]System.NotSupportedException::'.ctor'()
IL_0005: throw
} // end of method <UsingYield>c__Iterator0::Reset
 
.property instance int32 'System.Collections.Generic.IEnumerator<int>.Current' ()
{
.get instance default int32 Program/'<UsingYield>c__Iterator0'::'System.Collections.Generic.IEnumerator<int>.get_Current' ()
}
.property instance object System.Collections.IEnumerator.Current ()
{
.get instance default object Program/'<UsingYield>c__Iterator0'::System.Collections.IEnumerator.get_Current ()
}
} // end of class <UsingYield>c__Iterator0
 
} // end of class Program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.