Mega Code Archive

 
Categories / C# Tutorial / Thread
 

Display main threads name

using System;  using System.Threading;    class MainClass {    public static void Main() {      Thread thrd = Thread.CurrentThread;        if(thrd.Name == null)        Console.WriteLine("Main thread has no name.");      else        Console.WriteLine("Main thread is called: " + thrd.Name);      }  } Main thread has no name.