I want to provide a task-based asynchronous pattern-style method. When awaiting the method, I could not find any difference between these two ways of providing the method:
// GetStats is a delegate for a void method in this example
public Task GetStatsAsync()
public async Task GetStatsAsync()
return await TaskEx.Run(GetStats);
Those are both logically the same, but the second one has more overhead and is not recommended for that reason.
For more information on the overhead of
async, I recommend the Zen of Async by Stephen Toub.
You probably also want to read "Should I Expose Asynchronous Wrappers for Synchronous Methods?" In short, the answer is "no."