Si tu reprends ton exemple de code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| static void Main(string[] args) {
Console.WriteLine(DateTime.Now.ToString("HH:mm.ss"));
var t = Async3Times();
t.Wait();
Console.WriteLine(DateTime.Now.ToString("HH:mm.ss"));
Console.ReadLine();
}
private async static Task Async3Times()
{
await HelloWorldAsync();
await HelloWorldAsync();
await HelloWorldAsync();
} |
Là on attend 12 secondes.
S'il y avait eu création de threads différents et donc exécution en parallèle, ça aurait pris 4 secondes.
Ou alors j'ai zappé un truc, c'est pas trop mon domaine ça
Partager