Get list of threads

c#, list, multithreading

Solution

using System.Diagnostics;

ProcessThreadCollection currentThreads = Process.GetCurrentProcess().Threads;

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

Problem

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?

Original source

Related problems