- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
- Related Articles
- C# Program to Check status of Current Thread
- How to display the name of the Current Thread in C#?
- How to find the Current Context id of the Thread in C#?
- How to check current state of a thread in C#?
- C# Program to display name of Current Thread
- How to get getAllStackTraces of current thread in android?
- How to get current status bar elevation in android?
- How to get current thread count in android?
- How to get current thread id in android?
- How to get current thread name in android?
- How to get current thread priority in android?
- How to get current thread state in android?
- How to get current thread is daemon in android?
- How to get current thread is interrupted in android?
- How to display all stack frames of the current thread in Java 9?

Advertisements