Q:

Generic repository Get() IEnumerable to Async

This is my first Asynchronous EF attempt :)
I am having a generic entity framework repository and I want to make it async.
The original code is: 
public virtual IEnumerable<TEntity> Get()
{
    IQueryable<TEntity> query = dbSet;
    return query.ToList();
} 

I trnsfor it as:
public class GenericRepository<TEntity> where TEntity : class
{
    internal Context context;
    internal DbSet<TEntity> dbSet;

    public GenericRepository(Context context)
    {
        this.context = context;
        this.dbSet = context.Set<TEntity>();
    } 

    public virtual Task<IEnumerable<TEntity>> Get()
    {
        IQueryable<TEntity> query = dbSet;
        return query.ToListAsync();
    } 
}

However, I have compile error, cannot convert type System.threading.Tasks.Task> to return type Tasks.Task>
The ToListAsync() method retrieve a list and I am expecting an Task>, my oringinal IEnumerable results is using elsewhere to populate selectbox
_xxx.Get().Select(x => new SelectListItem
            {
                Value = x.ps_id.ToString(),
                Text = x.ps_label
            }).OrderBy(x => x.Text);

Can you point me out what need to be done to do it correctly
Thanks

A:

Task<T> is invariant because it's a class. It makes more sense to return a list since you're going through the work of making it that way anyway.
public virtual Task<List<TEntity>> Get()
{
    IQueryable<TEntity> query = dbSet;
    return query.ToListAsync();
} 

