1

What is the difference between these two code samples?

    public async Task<Product> GetProduct(string id)
    {
        return await _context
                       .Products
                       .Find(p => p.Id == id)
                       .FirstOrDefaultAsync();
    }

And

    public Task<Product> GetProduct(string id)
    {
        return _context.Products.Find(x => x.Id == id).FirstOrDefaultAsync();
    }

Does it make a difference?

  • 3
    Check out this great article by Stephen Cleary! [Eliding Async and Await](https://blog.stephencleary.com/2016/12/eliding-async-await.html) – Theodor Zoulias Jul 15 '22 at 11:03

0 Answers0