Skip to content

Instantly share code, notes, and snippets.

@upsilon
Created February 9, 2013 14:07
Show Gist options
  • Select an option

  • Save upsilon/4745339 to your computer and use it in GitHub Desktop.

Select an option

Save upsilon/4745339 to your computer and use it in GitHub Desktop.
usingブロックの中でクロージャー
using System;
using System.Windows.Forms;
using NUnit.Framework;
class ClosureTest
{
[Test]
public void ClosureWithinUsingTest()
{
Func<bool> closure;
using (var obj = new Control())
{
closure = () => obj.IsDisposed;
}
Assert.IsFalse(closure()); // Fail
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment