This line in main
Task.Run(f);
with this function in the same class Program
static int f() { return 0; }
causes this compile error (there are no other methods called f
in Program
):
CS0121 The call is ambiguous between the following methods or properties: 'Task.Run<TResult>(Func<TResult>)' and 'Task.Run(Func<Task>)'
Isn't it obviously Func<int>
and not Func<Task>
?
However, all of these work:
Task.Run(() => 0);
Task.Run(() => f());
Task.Run(async () => f());