Thursday, November 28, 2013

Get current ID in Task object (C#)

Doing some research on Task (TPL) i wonder if there's a way in retrieving the id of the current task executing. In thread, we can do it like this:
Code:
Thread.CurrentThread.Name; 
The equivalent code in task is shown below:
Code:
int currentTask = Task.CurrentId;  
Greg

0 comments:

Post a Comment