Get current thread name

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Code Snippets

C# Source Code Bank

See also …
edit

This C# code snippet gets the name of the current thread by examining the Name property of the current thread.

class ThreadName
{    
   public static void Main() 
   {
      Thread thread = Thread.CurrentThread;
      Console.WriteLine ("Name: {0}", thread.Name);
   }
}


 Thread.CurrentThread.Name (program output)
Name: CSharp-Online.NET Thread

Personal tools