Set 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 sets the name of the current thread by setting the Name property of the current thread.

class ThreadName
{    
   public static void Main() 
   {
      Thread thread = Thread.CurrentThread;
      thread.Name = "CSharp-Online.NET Thread";
   }
}


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

Today's Deals: Electronics

Personal tools