Suppose I have a reference to a Thread object, such as:
System.Threading.Thread thread;
If I want to determine whether the current thread is represented by this object, should the following code be used?
bool currentThread = (thread.ManagedThreadId == Thread.CurrentThread.ManagedThreadId);
I’m pretty sure this will work fine, but it seems strange that there wouldn’t be a more direct method for checking this. Is there one?
Just use
Thread.CurrentThread: