Hi,
Is it possible to get the instance of a specific running thread knowing its name or id? If yes, how?
Thank you
Hi,
Is it possible to get the instance of a specific running thread knowing its name or id? If yes, how?
Thank you
Not sure if there's a more direct way but in the worst case you should be able to loop through all the threads in Process.Threads
and checking the ProcessThread.Id
of them.
Here's the MSDN doc for ProcessThread properties.
You could try something like this:
Thread thread = Process.GetCurrentProcess().Threads.Single(t => t.ManagedThreadId == threadId);
HTH