Getting physical thread Id

  • Thread starter Thread starter Hayk
  • Start date Start date
H

Hayk

Hello,
Does anyone know how to get the current thread's ID
in .Net (e.g., for logging purposes)?
The Thread class doesn't have thread Id member. There is
the Process.Threads property, which returns collection of
ProcessThread objects which have IDs, but then how do you
find out which one of them is the current thread?
Thanks,
Hayk
 
The Thread class doesn't have thread Id member.

But it does have the GetHashCode() which is good enough for most
purposes.

There's also the AppDomain.GetCurrentThreadId() method.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top