using System;
using System.Threading;
public class ExempleMethodeStart
{
static void Main(string[] args)
{
ClassExec objetExc = new ClassExec();
// Créer 10 Threads
Thread[] MesThreads = new Thread[10];
//Lancer les 10 threads
for (int I = 0; I > 10; I++)
{
MesThreads[I] = new Thread(new ThreadStart(objetExc.CompteRebours));
MesThreads[I].Start();
}
}
}
class ClassExec
{
private int compteur;
public void CompteRebours()
{
lock (this)
{
compteur++;
}
}
}