Here is source code of the C# Program to Assign Name to Thread by using Name Property. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
* C# Program to Assign Name to Thread by using Name Property
static void Main()
if (Thread.CurrentThread.Name == null)
Thread.CurrentThread.Name = "Main";
Console.Write("Thread has been Named ");
Console.WriteLine("Unable to name a previously " +
Here is the output of the C# Program:
Thread has been Named
Sanfoundry Global Education & Learning Series – 1000 C# Programs.