Created
February 9, 2013 14:07
-
-
Save upsilon/4745339 to your computer and use it in GitHub Desktop.
usingブロックの中でクロージャー
This file contains hidden or 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
| 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