Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public void DifferentScopes(int arg)
{
Func<int, Func<int>> preventClosure = (val) => () => val;
{
int local = 42;
Func<int> a = () => preventClosure(local)();
Func<int> b = () => preventClosure(local)();
}
Func<int> c = () => preventClosure(arg)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment