Skip to content

Instantly share code, notes, and snippets.

@mgravell
Created February 17, 2020 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgravell/8e08a7d3dbf3bbfc17ff46c494a59150 to your computer and use it in GitHub Desktop.
Save mgravell/8e08a7d3dbf3bbfc17ff46c494a59150 to your computer and use it in GitHub Desktop.
class P
{
static Task Main()
{
var task = new P().DoNothing();
Console.WriteLine(task.IsCompleted ? "sync" : "async");
return task;
}
async Task DoNothing()
{
const bool configureAwait = false;
await Wait0().ConfigureAwait(configureAwait);
await Wait0().ConfigureAwait(configureAwait);
}
async Task<int> Wait0() { await Task.Delay(500); return 0; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment