Hello,
A detailed error resolution of this error code is given in the official C# documentation.
'type' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'type' could be found (are you missing a using directive or an assembly reference?). This error occurs when you try to call a method or access a class member that does not exist.
Please refer to Compiler Error CS1061 for more details.
CS1061 'Task<Forecast>' does not contain a definition for 'List' and no accessible extension method 'List' accepting a first argument of type 'Task<Forecast>' could be found (are you missing a using directive or an assembly reference?)
According to the above error message you provided, Task<Forecast>
is not a collection class, so you cannot call List to return a list.
You could replace networkManager.GetForecast(city.Id).List;
with networkManager.GetForecast(city.Id).Result;
.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.