Last active
August 22, 2019 10:36
-
-
Save controlflow/f0629523304b5f425062b30d6468dca1 to your computer and use it in GitHub Desktop.
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
// 1 | |
foreach (var x in xs) | |
using (var r = x.GetResource()) | |
DoWork(x, r); | |
// 2 | |
foreach (var x in xs) | |
using (var r = x.GetResource()) { | |
DoWork(x, r); | |
DoOtherWork(r); | |
} |
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
// 1 | |
foreach (var x in xs) { | |
using var r = x.GetResource(); | |
DoWork(x, r); | |
} | |
// 2 | |
foreach (var x in xs) { | |
using var r = x.GetResource(); | |
DoWork(x, r); | |
DoOtherWork(r); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment