वर्तमान थ्रेड की स्थिति प्राप्त करने के लिए, IsAlive() विधि का उपयोग करें -
सबसे पहले, एक नया थ्रेड बनाएं -
Thread t = Thread.CurrentThread; t.Name = "Our Thread";
अब, वर्तमान थ्रेड की स्थिति प्राप्त करने के लिए -
t.IsAlive
निम्नलिखित पूरा कोड है -
उदाहरण
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();
}
}
} आउटपुट
Status = True