Created
May 2, 2017 21:16
-
-
Save BillWagner/d9bf14fa3ad612068eca61c6d2e1f98a to your computer and use it in GitHub Desktop.
local functions and lambdas and expressions, oh my
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
Func<int> foo = () => | |
{ | |
int M1() | |
{ | |
return 19; | |
} | |
return M1() + M2(); | |
int M2() => 23; | |
}; | |
WriteLine(foo()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those curious, TryRoslyn link to see what the compiler turns this into.
That's some serious effort that went into the compiler to navigate this rabbit hole.