7

As far as I know, there are three ways to call async method. (I'm sure there are much more)

  • 1> Task.Run(async () = {...}).
  • 2> Just calling AAA();

and AAA should be looks like

async void AAA()
{
...
}
  • 3> 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?

1 Answer 1

7
  1. Executes AAA on a thread pool thread.
  2. Executes AAA on the calling thread.
  3. Executes AAA on the main thread.

As an aside, you should avoid async void methods.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much. It's really helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.