[Proposal]: await using and ConfigureAwait without going back to pre C# 8 indentation #4134
-
[Proposal]: await using and ConfigureAwait without going back to pre C# 8 indentation
SummaryAllow C# 8 using declaration with await using and .ConfigureAwait(false) Current syntax: var c = new MyAsyncDisposableClass();
await using (c.ConfigureAwait(false))
{
...
} Proposed syntax: var c = new MyAsyncDisposableClass();
await using c.ConfigureAwait(false);
... MotivationWith release of C# 8, most
Our project, which creates a lot of Detailed designDrawbacksAlternativesUnresolved questionsNot sure how important it is to use the ConfigureAwait extension, since the EF Core sample doesn't use it and there is no compiler / analyzer warning if omitted. Design meetings |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Note that you can write the code like this: await using var _ = c.ConfigureAwait(false); (This actually declares a variable named Also, I think this is pretty much a duplicate of #2235. |
Beta Was this translation helpful? Give feedback.
Note that you can write the code like this:
(This actually declares a variable named
_
, it's not a discard.)Also, I think this is pretty much a duplicate of #2235.