I want to mimic the behavior of objective-c dispatch queues in c#. I see that there is a task parallel library but I really don't understand how to use it and was hoping to get some explanation on how.
In objective c i would do something like:
-(void)doSomeLongRunningWorkAsync:(a_completion_handler_block)completion_handler
{
dispatch_async(my_queue, ^{
result *result_from_long_running_work = long_running_work();
completion_handler(result_from long_running_work);
});
}
-(void)aMethod
{
[self doSomeLongRunningWorkAsync:^(result *) { // the completion handler
do_something_with_result_from_long_running_async_method_above;
}];
}
How is this translated into c# style task parallel library?
Any comparison sites?