Threading.Tasks.Task' does not contain a definition for 'Result'
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.
You will get this error if you're trying to use .Result
on a Task
object. This might be because you meant to use Task<T>
. But, if you want meant to use Task and you want it to return without using await then Task is like void and does not have a result. You can use .Wait()
instead. This returns void.