From ec71fbb5ae4136818848eca2218d044b24d67bbc Mon Sep 17 00:00:00 2001 From: RamonTC Date: Tue, 21 Mar 2017 12:52:59 +0100 Subject: [PATCH] Remove async await issue comments --- src/Web/WebMVC/ViewComponents/CartList.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Web/WebMVC/ViewComponents/CartList.cs b/src/Web/WebMVC/ViewComponents/CartList.cs index 055a79a25..099cc8a3d 100644 --- a/src/Web/WebMVC/ViewComponents/CartList.cs +++ b/src/Web/WebMVC/ViewComponents/CartList.cs @@ -19,22 +19,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents var item = await GetItemsAsync(user); return View(item); } - - // Notice that this method is a Task - // returning asynchronous method. But, it does not - // have the 'async' modifier, and does not contain - // any 'await statements. - // The only asynchronous call is the last (or only) - // statement of the method. In those instances, - // a Task returning method that does not use the - // async modifier is preferred. The compiler generates - // synchronous code for this method, but returns the - // task from the underlying asynchronous method. The - // generated code does not contain the state machine - // generated for asynchronous methods. - // Contrast that with the method above, which calls - // and awaits an asynchronous method, and then processes - // it further. + private Task GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user); } }