Skip to content

Instantly share code, notes, and snippets.

@yowl
Created December 26, 2019 20:56
Show Gist options
  • Save yowl/a84b4907832ce8fc2f168d4c0474e9f4 to your computer and use it in GitHub Desktop.
Save yowl/a84b4907832ce8fc2f168d4c0474e9f4 to your computer and use it in GitHub Desktop.
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static int a(int i)
{
return i;
}
public static void Main()
{
var l = new List<int>();
l.AddRange (from x in Enumerable.Range(1, 10).AsQueryable() select a (x));
}
}
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class public auto ansi beforefieldinit Program
extends [mscorlib]System.Object
{
// Nested Types
.class nested private auto ansi sealed serializable beforefieldinit '<>c'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
// Fields
.field public static initonly class Program/'<>c' '<>9'
// Methods
.method private hidebysig specialname rtspecialname static
void .cctor () cil managed
{
// Method begins at RVA 0x20dd
// Code size 11 (0xb)
.maxstack 8
IL_0000: newobj instance void Program/'<>c'::.ctor()
IL_0005: stsfld class Program/'<>c' Program/'<>c'::'<>9'
IL_000a: ret
} // end of method '<>c'::.cctor
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x20d4
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method '<>c'::.ctor
} // end of class <>c
// Methods
.method public hidebysig static
int32 a (
int32 i
) cil managed
{
// Method begins at RVA 0x2050
// Code size 7 (0x7)
.maxstack 1
.locals init (
[0] int32
)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method Program::a
.method public hidebysig static
void Main () cil managed
{
// Method begins at RVA 0x2064
// Code size 100 (0x64)
.maxstack 8
.locals init (
[0] class [mscorlib]System.Collections.Generic.List`1<int32>,
[1] class [System.Core]System.Linq.Expressions.ParameterExpression
)
IL_0000: nop
IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1<int32>::.ctor()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.1
IL_0009: ldc.i4.s 10
IL_000b: call class [mscorlib]System.Collections.Generic.IEnumerable`1<int32> [System.Core]System.Linq.Enumerable::Range(int32, int32)
IL_0010: call class [System.Core]System.Linq.IQueryable`1<!!0> [System.Core]System.Linq.Queryable::AsQueryable<int32>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0015: ldtoken [mscorlib]System.Int32
IL_001a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_001f: ldstr "x"
IL_0024: call class [System.Core]System.Linq.Expressions.ParameterExpression [System.Core]System.Linq.Expressions.Expression::Parameter(class [mscorlib]System.Type, string)
IL_0029: stloc.1
IL_002a: ldnull
IL_002b: ldtoken method int32 Program::a(int32)
IL_0030: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0035: castclass [mscorlib]System.Reflection.MethodInfo
IL_003a: ldc.i4.1
IL_003b: newarr [System.Core]System.Linq.Expressions.Expression
IL_0040: dup
IL_0041: ldc.i4.0
IL_0042: ldloc.1
IL_0043: stelem.ref
IL_0044: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression, class [mscorlib]System.Reflection.MethodInfo, class [System.Core]System.Linq.Expressions.Expression[])
IL_0049: ldc.i4.1
IL_004a: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_004f: dup
IL_0050: ldc.i4.0
IL_0051: ldloc.1
IL_0052: stelem.ref
IL_0053: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`2<int32, int32>>(class [System.Core]System.Linq.Expressions.Expression, class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_0058: call class [System.Core]System.Linq.IQueryable`1<!!1> [System.Core]System.Linq.Queryable::Select<int32, int32>(class [System.Core]System.Linq.IQueryable`1<!!0>, class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`2<!!0, !!1>>)
IL_005d: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<int32>::AddRange(class [mscorlib]System.Collections.Generic.IEnumerable`1<!0>)
IL_0062: nop
IL_0063: ret
} // end of method Program::Main
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x20d4
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Program::.ctor
} // end of class Program
{
"version": 1,
"target": "IL",
"mode": "Debug",
"branch": "x64"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment