I assumed lambda functions
, delegates
and anonymous functions
with the same body would have the same \"speed\", however, running the follo
Other peoples results suggest that the performance is the same:
http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2007/12/11/anonymous-delegates-vs-lambda-expressions-vs-function-calls-performance.aspx
As noted in the comments, micro-benchmarks are often misleading. There are too many factors over which you have no control, JIT optimisation, garbage collection cycles, etc ...
See this related question:
When not to use lambda expressions
Finally, I think your test is fundamentally flawed! You use a Linq Where
extension method to execute your code. However, Linq uses lazy-evaluation, your code will only be executed if you start iterating over the results!