सी# में थ्रेड की प्राथमिकता दिखाने के लिए, प्राथमिकता का उपयोग करें संपत्ति।
सबसे पहले, currentThread . का उपयोग करें एक थ्रेड के बारे में जानकारी प्रदर्शित करने के लिए संपत्ति -
Thread thread = Thread.CurrentThread;
अब थ्रेड का उपयोग करें। प्राथमिकता संपत्ति धागे की प्राथमिकता प्रदर्शित करने के लिए -
thread.Priority
उदाहरण
C# में थ्रेड की प्राथमिकता दिखाने के लिए पूरा कोड देखते हैं।
using System;
using System.Threading;
namespace Demo {
class MyClass {
static void Main(string[] args) {
Thread thread = Thread.CurrentThread;
thread.Name = "My Thread";
Console.WriteLine("Thread Priority = {0}", thread.Priority);
Console.ReadKey();
}
}
} आउटपुट
Thread Priority = Normal