using System; using System.Threading; namespace Threads { public class MonThread { int i = 0; public MonThread(int i) { this.i = i; } public void ThreadFonction() { for(; i<=30; i++) { Console.WriteLine(i.ToString()); Thread.Sleep(300); } } } public class Exemple { // Point d'entrée de l'application public static void Main() { MonThread mt1 = new MonThread(5); Thread t1 = new Thread(new ThreadStart(mt1.ThreadFonction)); t1.Start(); MonThread mt2 = new MonThread(10); Thread t2 = new Thread(new ThreadStart(mt2.ThreadFonction)); t2.Start(); } } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question