Skip to content

Instantly share code, notes, and snippets.

@victorarias
Created January 10, 2013 13:35
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 victorarias/4502071 to your computer and use it in GitHub Desktop.
Save victorarias/4502071 to your computer and use it in GitHub Desktop.
IL_001e: call class [System]System.Diagnostics.Stopwatch [System]System.Diagnostics.Stopwatch::StartNew()
IL_0023: stloc.1
IL_0024: ldloc.0
IL_0025: ldsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
IL_002a: brtrue.s IL_003d
IL_002c: ldnull
IL_002d: ldftn bool ConsoleApplication5.Program::'<Main>b__1'(class ConsoleApplication5.Program/Fuu)
IL_0033: newobj instance void class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool>::.ctor(object,
native int)
IL_0038: stsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
IL_003d: ldsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
IL_0042: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class ConsoleApplication5.Program/Fuu>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_0047: pop
IL_0048: ldloc.1
IL_0049: callvirt instance void [System]System.Diagnostics.Stopwatch::Stop()
IL_005e: call class [System]System.Diagnostics.Stopwatch [System]System.Diagnostics.Stopwatch::StartNew()
IL_0063: stloc.1
IL_0064: ldloc.0
IL_0065: ldsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate4'
IL_006a: brtrue.s IL_007d
IL_006c: ldnull
IL_006d: ldftn bool ConsoleApplication5.Program::'<Main>b__2'(class ConsoleApplication5.Program/Fuu)
IL_0073: newobj instance void class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool>::.ctor(object,
native int)
IL_0078: stsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate4'
IL_007d: ldsfld class [mscorlib]System.Func`2<class ConsoleApplication5.Program/Fuu,bool> ConsoleApplication5.Program::'CS$<>9__CachedAnonymousMethodDelegate4'
IL_0082: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class ConsoleApplication5.Program/Fuu>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_0087: pop
IL_0088: ldloc.1
IL_0089: callvirt instance void [System]System.Diagnostics.Stopwatch::Stop()
class Program
{
private class Fuu
{
public int A { get; set; }
public string B { get; set; }
}
static void Main(string[] args)
{
var list = new List<Fuu>{ new Fuu{}, new Fuu{}};
var sw = Stopwatch.StartNew();
var query = list.Where(a => a.A == 1 && a.B == "fuu");
sw.Stop();
Console.WriteLine(sw.Elapsed);
sw = Stopwatch.StartNew();
query = from p in list
where p.A == 1 && p.B == "fuu"
select p;
sw.Stop();
Console.WriteLine(sw.Elapsed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment