fork download
  1. using System;
  2. using System.Threading;
  3.  
  4. public class Work
  5. {
  6. public static void Main()
  7. {
  8. // Start a thread that calls a parameterized static method.
  9. Thread newThread = new Thread(Work.DoWork);
  10. newThread.Start(42);
  11.  
  12. // Start a thread that calls a parameterized instance method.
  13. Work w = new Work();
  14. newThread = new Thread(w.DoMoreWork);
  15. newThread.Start("The answer.");
  16. }
  17.  
  18. public static void DoWork(object data)
  19. {
  20. Console.WriteLine("Static thread procedure. Data='{0}'",
  21. data);
  22. }
  23.  
  24. public void DoMoreWork(object data)
  25. {
  26. Console.WriteLine("Instance thread procedure. Data='{0}'",
  27. data);
  28. }
  29. }
Success #stdin #stdout 0s 201280KB
stdin
Standard input is empty
stdout
Static thread procedure. Data='42'
Instance thread procedure. Data='The answer.'