Browse Source

Remove async await issue comments

pull/126/head
RamonTC 8 years ago
committed by GitHub
parent
commit
ec71fbb5ae
1 changed files with 1 additions and 16 deletions
  1. +1
    -16
      src/Web/WebMVC/ViewComponents/CartList.cs

+ 1
- 16
src/Web/WebMVC/ViewComponents/CartList.cs View File

@ -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<Basket> GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user);
}
}

Loading…
Cancel
Save