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