C# 程式用於顯示執行緒優先順序
要顯示 C# 中執行緒的優先順序,請使用 Priority 屬性。
首先,使用 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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP