Reputation: 9242
I am trying programming in android
using Xamarin.android
using C#. While watching a tutorial of android I have found out that they are using Thread
for asynchronous programming but in C# Async/Await is what i like to do.
So my question is - Can these Threads
be replaced directly by Async/Await Tasks
in C#.
Upvotes: 0
Views: 558
Reputation: 1502825
It depends on what sort of asynchronous programming you're talking about. If it's background processing, then you'll still want a task on a different thread. You can still use async/await for that, of course.
If it's really just asynchronous IO - make a web request, wait for the result, etc - then yes, async/await should make this much simpler, and you should be able to avoid having any extra threads.
Upvotes: 3