C#에서 스레드의 우선 순위를 표시하려면 우선 순위를 사용하세요. 재산.
먼저 currentThread를 사용합니다. 스레드에 대한 정보를 표시하는 속성 -
Thread thread = Thread.CurrentThread;
이제 thread.Priority 사용 스레드의 우선 순위를 표시하는 속성 -
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