What is the best way to return a task that doesn't have a generic type parameter? In other words a task that represents an operation that doesn't return anything or returns void
?
In other words, I am looking for alternatives for the following:
T value = default(T);
return Task.FromResult<T>(value); // and
var tcs = new TaskCompletionSource<T>();
tcs.SetResult(value);
return tcs.Task;
But for tasks that represent operations that are not supposed to return anything.