C#

C#

Made by DeepSource

Use Environment.CurrentManagedThreadId to fetch the thread ID instead of Thread.CurrentThread.ManagedThreadId CS-P1014

Performance
Major
Autofix

You 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.

Bad Practice

var threadId = Thread.CurrentThread.ManagedThreadId;

Recommended

var threadId = Environment.CurrentManagedThreadId;

Reference