Does the compiler optimize lambdas as static? #122476
Answered
by
stephentoub
CodingOctocat
asked this question in
Q&A
-
|
I don't want to explicitly add the list.Where(x => x > 10);vs list.Where(static x => x > 10); |
Beta Was this translation helpful? Give feedback.
Answered by
stephentoub
Dec 12, 2025
Replies: 1 comment
-
|
Those are identical.... static on a lambda has zero impact on the generated code. It only serves to prevent closures by causing errors if one would be taken. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CodingOctocat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Those are identical.... static on a lambda has zero impact on the generated code. It only serves to prevent closures by causing errors if one would be taken.