programming-examples/c-sharp/Games_&_Threads/C# Program to Assign Name to Thread by using Name Property.cs
2019-11-15 12:59:38 +01:00

25 lines
578 B
C#

/*
* C# Program to Assign Name to Thread by using Name Property
*/
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();
}
}
/*
Thread has been Named