Skip to content

Instantly share code, notes, and snippets.

@howarddierking
Created November 30, 2011 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howarddierking/1410489 to your computer and use it in GitHub Desktop.
Save howarddierking/1410489 to your computer and use it in GitHub Desktop.
WCF 4.5 Async Service Operation
public async Task<double> CalculateShippingSubtotalAsync(int productID, string postalCode)
{
var productServiceProxy = new ProductServiceClient();
var shippingServiceProxy = new ShippingServiceClient();
var t = productServiceProxy.GetProductByIDAsync(productID);
var t2 = shippingServiceProxy.GetShippingCostForPostalCodeAsync(postalCode);
await Task.WhenAll(t, t2);
return t.Result.UnitPrice + t2.Result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment