Open Almantask opened 3 years ago
You are right. This could be replaced. Fair feedback that will be incorporated at some point.
This sample was prepared (long) before async main was supported by C#, and currently has not been ported up to a higher version of C# in order to maintain the greatest compatibility with older codebases and compilers. There are many improvements like this that we can make once we decide to move up the minimum language version we support.
I am surprised to see
and not
My concern is that,
Thread.Sleep
is a blocking operation. Won't it completely disable 1 thread from doing any work at all times? Won'tTask.Delay
give the thread back to the scheduler instead so it could do whatever it has to, while it simply await and not blocks?Please let me know if the example is simply outdated or if it is justified. Thanks!