Code:
using System;
using System.Threading;
class Name
{
static void Main()
{
if (Thread.CurrentThread.Name == null)
{
Thread.CurrentThread.Name = "Main";
Console.Write("Thread has been Named ");
}
else
{
Console.WriteLine("Unable to name a previously " +
"named thread.");
}
Console.ReadLine();
}
}
Output:
Thread has been Named
More C# Programs: