C Sharp Main Thread

C# Main Thread

Inside a process, the main thread is the first created thread which starts first and ends at last.

Example:

using System;  
using System.Threading;  
public class Example  
{  
    public static void Main(string[] args)  
    {  
        Thread x = Thread.CurrentThread;  
        x.Name = "Hello";  
        Console.WriteLine(x.Name);  
    }  
}

Output:

Explanation:

In the above example, we are displaying the use and behavior of the Main thread in C#.

 

Please Share