This is a C# Program to obtain status of the current thread.
This C# Program Obtains the Status of the Current Thread.
Here a Thread is the representation of the currently running thread and the true or false is displayed as a result of the status method.
Here is source code of the C# Program to Obtain Status of the Current Thread . The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Obtain Status of the Current Thread */ using System; using System.Threading; namespace threading { class Program { static void Main(string[] args) { Console.WriteLine("Current information"); Thread t = Thread.CurrentThread; t.Name = "primarythread"; Console.WriteLine("Thread Name: {0}", t.Name); Console.WriteLine("Thread Status: {0}", t.IsAlive); Console.ReadKey(); } } }
In this C# program, using if else condition statement. Check the CurrentThread() method value is equal to null. If the condition is true, then execute the statement and print the statement as thread has been named. Here a Thread is the representation of the currently running thread and then true or false is displayed as a result of the status method.
Current information Thread Name: primarythread Thread Status: True
Sanfoundry Global Education & Learning Series – 1000 C# Programs.
- Get Free Certificate of Merit in C# Programming
- Participate in C# Programming Certification Contest
- Become a Top Ranker in C# Programming
- Take C# Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Buy MCA Books
- Buy C# Books
- Buy Computer Science Books
- Practice MCA MCQs
- Practice Computer Science MCQs