Environment.CurrentManagedThreadId
to fetch the thread ID instead of Thread.CurrentThread.ManagedThreadId
CS-P1014You can use Thread.CurrentThread.ManagedThreadId
to access the running program's path. However, an easier alternative is to just use the static
field Environment.CurrentManagedThreadId
that does just the same. It is simpler and easier to read and remember.
var threadId = Thread.CurrentThread.ManagedThreadId;
var threadId = Environment.CurrentManagedThreadId;