As far as I know, there are three ways to call async method. (I'm sure there are much more)
Task.Run(async () = {...}).
AAA();
and AAA should be looks like
async void AAA()
{
...
}
Device.InvokeMainThread(async () => {...});
I know If I use option 1( Task.run
) process will go on background thread and option 3 is not.
What about option 2? It's on main thread if I called from OnAppearing()
?
First of all, Is there not any problem to use like that?
And option2 and 3 are same?
AAA
on a thread pool thread. AAA
on the calling thread. AAA
on the main thread. As an aside, you should avoid async void methods .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.