fork download
  1. using System;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. A().Wait();
  10. }
  11.  
  12. static async Task A() {
  13. await B();
  14. Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
  15. }
  16.  
  17. static async Task B() {
  18. await C();
  19. Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
  20. }
  21.  
  22. static async Task C() {
  23. await Task.Yield();
  24. Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
  25. }
  26. }
Success #stdin #stdout 0.01s 32888KB
stdin
Standard input is empty
stdout
4
4
4