Recently I have been just getting a bit confused on what to use for I/O Bound and Cpu Bound work and as of right now what I've concluded (feel free to correct) Is:
-Task.Run() - CPU bound work
-TaskCompletionSource - I/O bound work
Scenario:
You are stuck with a method that does i/o based work that runs sequentially and you cannot edit the method, What would be the best choice to make it run asynchronously?
//method example
//Purposely avoiding using the AsyncTask Version Of DownloadString In WebClient
public void Foo()=>new WebClient.DownloadString("https://google.com");
//-------
//here is the part of the code that I will be trying to execute Foo asynchronously
await Task.Run(()=>Foo()); //wouldn't this be the only way to run this method asynchronously even though Foo isn't doing CPU Bound Work?