
要在 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
以上就是C#显示线程优先级的程序的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1435088.html
微信扫一扫
支付宝扫一扫