Création d’un Thread en CSharp

Author:


{filelink=17365}

using System;
using System.Threading;

public class ExempleThread
{

  public static void Main()
  {

    // Création d'un Thread
    Thread th = new Thread(new ThreadStart(CompteRebours));

    // Lancer le Thread
    th.Start();

  }

  // Compte à Rebours de 1000 à 1
   public static void CompteRebours()
   {
    for (int compteur = 1000; compteur > 0; compteur--)
    {
      Console.Write(compteur.ToString() + " ");
    }
  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *