Android Question When to use Async versions of File.Copy, ListFiles

GuyBooth

Active Member
Licensed User
Longtime User
I use File.Copy and ListFiles in several places in my code.
I am not sure whether I should be replacing these methods with the new File.CopyAsync and ListFilesAsync, or whether I should leave them alone.
Is there a general guideline on where to use which? Is it better to always use the async version?
 

LucaMs

Expert
Licensed User
Longtime User
It's simple: you should use async METHODS (any method) if your app needs to do something WHILE the method is working and, usually, when the method might take "too much time" to complete.



[It is obvious that if you have to work on a copied file, you will have to wait for the copy to complete; in this case it is better to use a synchronous method (but you can also use the asynchronous method, waiting for its completion - a little bit more complicated)].
 
Upvote 0
Top