I have a scenario something like this:
int arr[100];
Parallel.Foreach(arr, (a) => { some processing});
Now, this code will spawn 100 child threads. How can I know thread ID for each child thread in "some processing" logic?
You could use
Thread.CurrentThread.ManagedThreadId
but note that your parallel foreach is not forced to actually create 100 threads.