Skip to content

Instantly share code, notes, and snippets.

@arialdomartini
Created March 2, 2020 13:25
Show Gist options
  • Save arialdomartini/3cd13b5a43f4b9ed00762ca76a84040a to your computer and use it in GitHub Desktop.
Save arialdomartini/3cd13b5a43f4b9ed00762ca76a84040a to your computer and use it in GitHub Desktop.
Implicitly Captured Closure: a
internal static class Foobar
{
private static Bar Foo(Func<Bar, Bar> f) => f(null);
internal class Bar
{
public Bar Use(Bar bar) => throw new NotImplementedException();
}
internal static void Warning()
{
var a = new Bar();
var b = new Bar();
var foo = Foo(i => a.Use(b));
var foo2 = Foo(i => b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment