![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to obtain Status of the Current Thread in C#?
To get the status of current thread, use the IsAlive() method −
Firstly, create a new thread −
Thread t = Thread.CurrentThread; t.Name = "Our Thread";
Now, to get the status of the current thread −
t.IsAlive
The following is the complete code −
Example
using System; using System.Threading; namespace Demo { class MyClass { static void Main(string[] args) { Thread t = Thread.CurrentThread; t.Name = "Our Thread"; Console.WriteLine("Status = {0}", t.IsAlive); Console.ReadKey(); } } }
Output
Status = True
Advertisements