获取线程列表 [英] Get list of threads

查看:72
本文介绍了获取线程列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想列出所有正在运行的线程,但不想使用List<>类.我想动态观察正在运行的线程.我该怎么办?

I want to list all running threads but not by using the List<> class. I want to dynamically observe running threads. How can I do that?

推荐答案

using System.Diagnostics;

ProcessThreadCollection currentThreads = Process.GetCurrentProcess().Threads;

foreach (ProcessThread thread in currentThreads)    
{
   // Do whatever you need
}

这篇关于获取线程列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆