Advertisement
RockField64

MyThreadClass

Nov 13th, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Threading;
  7.  
  8.  
  9. namespace frmTrackThreadChuaFinal
  10. {
  11.     class MyThreadClass
  12.     {
  13.         public void thread1()
  14.         {
  15.             for (int LoopCount = 0; LoopCount <= 2; LoopCount++)
  16.             {
  17.                 Thread thread = Thread.CurrentThread;
  18.                 Console.WriteLine("Name of Thread: " + thread.Name + " = " + LoopCount);
  19.                 Thread.Sleep(TimeSpan.FromSeconds(0.5));
  20.             }
  21.         }
  22.         public void thread2()
  23.         {
  24.             for (int LoopCount = 0; LoopCount <= 5; LoopCount++)
  25.             {
  26.                 Thread thread = Thread.CurrentThread;
  27.                 Console.WriteLine("Name of thread: " + thread.Name + " = " + LoopCount);
  28.                 Thread.Sleep(TimeSpan.FromSeconds(1.5));
  29.             }
  30.         }
  31.     }
  32. }
  33.  
  34.    
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement