HI WELCOME TO SIRIS

C# Main Thread Example

Leave a Comment
The first thread which is created inside a process is called Main thread. It starts first and ends at last.
Let's see an example of Main thread in C#.
  1. using System;  
  2. using System.Threading;  
  3. public class ThreadExample  
  4. {  
  5.     public static void Main(string[] args)  
  6.     {  
  7.         Thread t = Thread.CurrentThread;  
  8.         t.Name = "MainThread";  
  9.         Console.WriteLine(t.Name);  
  10.     }  
  11. }  
Output:
MainThread

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.