Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dispatch_async equivalent in xamarin.ios?

What is the equivalent of the following code in Xamarin.iOS?

    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
        //Background Thread
        dispatch_async(dispatch_get_main_queue(), ^(void){
            //Run UI Updates
        });
    });
like image 581
Shaheem Khan Avatar asked Jan 18 '18 19:01

Shaheem Khan


1 Answers

Here's pretty much the C# equivalent of your code:

using CoreFoundation;

DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default).DispatchAsync(() =>
{
    DispatchQueue.MainQueue.DispatchAsync(() => { });
});
like image 102
Nick Peppers Avatar answered Oct 23 '22 20:10

Nick Peppers