You’re returning Task
from the CreatingTask
method – you need to return Task<int>
, and then change tasks
to be Task<int>[]
instead of Task[]
.
Basically, Task
represents a task which doesn’t produce a result – whereas Task<T>
represents a task producing a result of type T
. In your case, everything throughout your code returns int
, so you need Task<int>
everywhere.