Skip to content

Instantly share code, notes, and snippets.

@NickCraver
Created July 22, 2018 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickCraver/3df15d31cfee64db7f9024ccaac8688e to your computer and use it in GitHub Desktop.
Save NickCraver/3df15d31cfee64db7f9024ccaac8688e to your computer and use it in GitHub Desktop.
A simple program showing Task.Delay(1) and what really happens
async Task Main()
{
for (var i = 0; i < 20; i++)
{
await Run(); // Just to show it many times
}
}
public async Task Run()
{
var sw = Stopwatch.StartNew();
await Task.Delay(1);
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment