
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
C# Program to Check status of Current Thread
To check the status of the current thread in C#, use the IsAlive property.
Firstly, use the currentThread property to display information about a thread −
Thread thread = Thread.CurrentThread;
Now use the thread.IsAlive property to check the status of the thread −
thread.IsAlive
Example
Let us see the complete code to check the status of current thread in C#.
using System; using System.Threading; namespace Demo { class MyClass { static void Main(string[] args) { Thread thread = Thread.CurrentThread; thread.Name = "My New Thread"; Console.WriteLine("Thread Status = {0}", thread.IsAlive); Console.ReadKey(); } } }
Output
Thread Status = True
- Related Articles
- How to obtain Status of the Current Thread in C#?
- C# Program to display name of Current Thread
- How to check current state of a thread in C#?
- Golang Program to Check Status of a URL_Website
- How can I check the current status of the GPS receiver in Android?
- How to display the name of the Current Thread in C#?
- C# Program to display priority of Thread
- C++ code to check review vote status and uncertainty
- How to find the Current Context id of the Thread in C#?
- Check if a thread belongs to managed thread pool or not in C#
- C# Program to implement Sleep Method Of Thread
- C# Program to Kill a Thread
- C# Program to Pause a Thread
- How to get getAllStackTraces of current thread in android?
- How to check whether a thread is a background thread or not in C#

Advertisements