When to use await Task.Run() and when to await an async method directly
I have seen several posts on this topic but the answers are complicated. Suppose I have the following code:
C# Task.Run only runs synchronously?
I’m trying to write a method that reads each page of a pdf, but since it takes a significant amount of time to read each page through the api and I’m looking at pdfs hundreds of pages long, I want to queue the reading of each page asynchronously and then return the results when they’re ready, so multiple pages are being read at once.
In C# async/await, does delay length affect when control go back to the caller?
The following code works as expected – both services start at the same time.