Created
July 22, 2018 12:14
-
-
Save NickCraver/3df15d31cfee64db7f9024ccaac8688e to your computer and use it in GitHub Desktop.
A simple program showing Task.Delay(1) and what really happens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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