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
 
Back
Top