Skip to content

Instantly share code, notes, and snippets.

@vietnt
Created February 2, 2012 19:29
Show Gist options
  • Save vietnt/1725261 to your computer and use it in GitHub Desktop.
Save vietnt/1725261 to your computer and use it in GitHub Desktop.
alt future ? = ]
interface IProductService
{
Future<int> GetPrice(string id);
Future<double> GetDiscount (int qty);
}
Future<int> GetQuote(string id, int qty)
{
var service = _activator.Get<IProductService>();
return
Future
.Of(
service.GetPrice (id),
service.GetDiscount (qty))
.WhenAvailable(
(price, discount)=> (int)(price * qty * discount));
}
@vietnt
Copy link
Author

vietnt commented Feb 2, 2012

@vietnt
Copy link
Author

vietnt commented May 23, 2013

from price in service.GetPrice (id)
from discount in service.GetDiscount(qty)
select (int) (price * qty * discount)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment