using System.Threading; using System; using System.IO; namespace ThreadingDemo { class Program { static void Main(string[] args) { Console.WriteLine("F1 F2 F3"); Thread thread1 = new Thread(Method1); Thread thread2 = new Thread(Method2); Thread thread3 = new Thread(Method3); thread1.Start(); thread2.Start(); thread3.Start(); Console.Read(); } public static void Method1() { for (int i = 1; i < 10; i++) { Thread.Sleep(1000); Console.WriteLine("F1 " + i); } } static void Method2() { for (int i = 1; i < 10; i++) { Thread.Sleep(2000); Console.WriteLine(" F2 " + i); } } static void Method3() { for (int i = 1; i < 10; i++) { Thread.Sleep(3000); Console.WriteLine(" F3 " + i); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)