home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / Threading / Thread / CS_Sample / Simple.cs < prev    next >
Encoding:
Text File  |  2000-06-23  |  608 b   |  30 lines

  1. using System;
  2. using System.Threading;
  3.  
  4. public class Alpha 
  5. {
  6.  
  7.     //    The method that will be called when the thread is started
  8.     public void Beta()
  9.     {
  10.         Console.WriteLine("Alpha.Beta is running in its own thread.");
  11.     }
  12. };
  13.  
  14. public class Simple
  15. {
  16.     public static int Main(String[] args)
  17.     {
  18.         Console.WriteLine("Thread Simple Sample");
  19.         Alpha        oAlpha        = new Alpha();
  20.  
  21.         //    Create the thread object, passing in the Alpha.Beta method
  22.         //    via a ThreadStart delegate
  23.         Thread        oThread        = new Thread(new ThreadStart(oAlpha.Beta));
  24.  
  25.         //    Start the thread
  26.         oThread.Start();
  27.  
  28.         return 0;
  29.     }
  30. }