How can I use a Task<string>
instance as a Task<string?> parameter to a method?
If I am using nullability enabled, and I have two async methods like..
// in an ordinary class
public async static Task<string> Foo() { ... }
// in a static class
public async static Task Bar(this Task<string?> task1) { ... }
I try to call await Foo().Bar();
, but the compiler gives me:
warning CS8620: Argument of type 'Task<string>' cannot be used for parameter 'task' of type 'Task<string?>'
What can I do to the result of Foo to make it acceptable as a Task<string?>?