Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public class ICountry<t>
{
C#
Task<IEnumerable<T>> GetAllAsync();


}

public class Country<t>:ICountry<t>
{
public async Task<ienumerable><t>> GetAllAsync()
{
//return await _Context.Set<t>().ToList();

error is
C#
'List<t>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'List<t>' could be found (are you missing a using directive or an assembly reference?)


}
}

What I have tried:

i try this

public async Task<ienumerable><t>> GetAllAsync()
{
return await _Context.Set<t>().ToList();
// error
'List<t>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'List<t>' could be found (are you missing a using directive or an assembly reference?)

}
it show me the error
List<t> does not contain defination for getawaiter no extension method
Posted
Updated 27-Aug-16 19:39pm
v2

1 solution

See if this gives you some ideas:
C#
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace YourNameSpace
{
    public interface ICountry<T> 
    {
        Task<IEnumerable<T>> GetAllAsync();
    }

    public class AwaitEx<T> : ICountry<T>
    {
        public async Task<IEnumerable<T>> GetAllAsync(???? context)
        {
            // ???? return await context.Set(????);
        }
    }
}
You need to show code that will tell us what 'Context is.
 
Share this answer
 
Comments
awaisshabir 28-Aug-16 1:16am    
Context is your dbContext
i already use this code but its show the same error

'List<t>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'List<t>' could be found (are you missing a using directive or an assembly reference?)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900