Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
 public List<CustomerModel> GetAll()
        {
            List<CustomerModel> customers = new List<CustomerModel>();
            db.Customers.ToList().ForEach(customer =>
                {
                    customers.Add(new CustomerModel()
                    {
                        CustomerId = customer.CustomerId,
                        FirstName = customer.FirstName,
                        LastName = customer.LastName,
                        Address = customer.Address,
                        CreatedAt = customer.CreatedAt
                    });
                });

            return customers;
        }

public async Task<List<CustomerModel>> GetAllAsync()
        {
           
            return await Task.Run((Func<List<CustomerModel>>)GetAll);
        }

public Task<List<CustomerModel>> GetAllTask()
        {
            return new Task<List<CustomerModel>>(GetAll);
        }


I am unable to call "GetAllTask" method with await keyword. please help and also suggest how to use and make pure awaitable methods.
Posted
Comments
[no name] 22-Apr-14 9:45am    
http://msdn.microsoft.com/en-us/library/hh156528.aspx

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