This project is read-only.

Support async in generic methods whose return value resolves to Task


The following method gives me CS1983: The return type of an async method must be void, Task or Task<T>
private async T Run<T>(Func<T> func) where T : Task
    return await func();
It should just compile because I've give the constraint that T is a Task.


nmgafter wrote Jan 5, 2015 at 10:47 PM

No, you have not constrained T to be Task. You've constrained it to be Task or some subclass.