[Proposal] Allow for inline creation and handling of IDisposable objects (RAAI)
See original GitHub issueProposed syntax would be
var x = using new Disposable();
var y = using new Disposable();
The code is just a shorter way of writing:
using (var x = new Disposable())
{
using (var y = new Disposable())
{
}
}
Which is actually much more composable with try-catch
pattern. Now we can remove one extra pair of curly braces and write:
try
{
var x = using new Disposable();
}
catch
{
// log and handle
}
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:18 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I like the syntax from #5881 better.
@gafter Since #5881 was previously closed as duplicate of this issue, shouldn’t it be reopened now?