The TaskCompletionSource<TResult>
class needs a TResult
type. That way, when I need to use this class without having a return type ( void
), I have to do something like:
var tcs = new TaskCompletionSource<object>();
// ...
tcs.TrySetResult(null);
I do not know if this is the best way to do when the return of a function is only a Task
, with no type at all. It seems to me gambiarra.
Is there no TaskCompletionSource
without the type parameter? Is there another way out?