question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Allow for inline creation and handling of IDisposable objects (RAAI)

See original GitHub issue

Proposed 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:closed
  • Created 9 years ago
  • Reactions:3
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gaftercommented, Nov 20, 2015

I like the syntax from #5881 better.

0reactions
svickcommented, Aug 15, 2016

@gafter Since #5881 was previously closed as duplicate of this issue, shouldn’t it be reopened now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found