Kevin Gosse
1 min readMay 19, 2020

--

Have a closer look at the generated code in the lambda case:

return Enumerable.Where(_list, <>c.<>9__2_0 ?? (<>c.<>9__2_0 = new Func<int, bool>(<>c.<>9.<GetItems>b__2_0)));

The delegate is cached in a static field, <>c.<>9__2_0 , and allocated only the first time.

--

--

Kevin Gosse
Kevin Gosse

Written by Kevin Gosse

Software developer at Datadog. Passionate about .NET, performance, and debugging.

No responses yet