A few things:
- You don't need the
async
on the method signature if there's noawait
in the body, so you can drop it from this:
Task.Run(async () => BigAndLongProcessAsync());
- Calling
BigAndLongProcessAsync();
without anawait
will result in all the synchronous code that's executed inBigAndLogProcessAsync
to be run synchronously on the calling thread. If there's anawait
in this method, everything after that line will be executed asynchronously, in a fire-and-forget manner, on a new thread. - Calling your method in a
Task.Run
allows you to run the entire method (including the synchronous code that precedes the firstawait
inside your method) on a separate thread.
Whether you use Task.Run
depends on whether you want to offload the synchronous work to the separate thread immediately. This may not be ideal as that synchronous code may need to run on the main thread as that thread is the only one that has access to certain resources (e.g. the main thread in Winforms is the thread that you'll want to manipulate UI elements from), in which case your first example would be necessary.