Created
February 2, 2012 19:29
-
-
Save vietnt/1725261 to your computer and use it in GitHub Desktop.
alt future ? = ]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from price in service.GetPrice (id)
from discount in service.GetDiscount(qty)
select (int) (price * qty * discount)