Do lambdas get inlined?
问题 Do simple lambda expressions get inlined? I have a tendency (thanks to F# and other functional forays) to encapsulate repeated code present within a single function into a lambda, and call it instead. I'm curious if I'm incurring a run-time overhead as a result: var foo = a + b; var bar = a + b; vs Func<T1, T2> op = () => a + b; var foo = op(); var bar = op(); Which one costs more to run? 回答1: No. Lambda functions are not inlined but instead are stored as delegates under the hood and incur