.Net 4.0 parallel - how to know when task is finished
I have a Tasks table. Tasks are added to this table all the time. After task is finished, I should delete it from the table and perform some other operations. The tasks should be ex开发者_开发问答ecuted concurrently. If I use Task class (Task.Factory.StartNew...), how can I know when Task is finished, in order to perform some operations regarding to it?
Thanks in advance!
Well, you can test for completion with Task.IsCompleted
. You can wait for a task to be completed with Task.Wait
(or a variant). You can tell a task to do something else afterwards with Task.ContinueWith
. The last one here may well be what you want here.
精彩评论