J
jmDesktop
I was reading the June 2008 MSDN magazine and it has this:
Array.Find(_handlers, h => h.CanProcess(order));
What does the => symbol mean? I understand it is using polymorphism,
but I don't know what the symbol means. Thanks.
I did try and search first.
all code and url below
public class OrderProcessingModule {
private IOrderHandler[] _handlers;
public OrderProcessingModule() {
_handlers = new IOrderHandler[] {
new InternationalOrderHandler(),
new SmallDomesticOrderHandler(),
new LargeDomesticOrderHandler(),
};
}
public void Process (OrderStatusMessage orderStatusMessage,
Order order) {
// Apply the changes to the Order from the OrderStatusMessage
updateTheOrder(order);
// Find the first IOrderHandler that "knows" how
// to process this Order
IOrderHandler handler =
Array.Find(_handlers, h => h.CanProcess(order));
handler.ProcessOrder(order);
}
private void updateTheOrder(Order order) {
}
}
http://msdn.microsoft.com/en-us/magazine/cc546578.aspx
Array.Find(_handlers, h => h.CanProcess(order));
What does the => symbol mean? I understand it is using polymorphism,
but I don't know what the symbol means. Thanks.
I did try and search first.
all code and url below
public class OrderProcessingModule {
private IOrderHandler[] _handlers;
public OrderProcessingModule() {
_handlers = new IOrderHandler[] {
new InternationalOrderHandler(),
new SmallDomesticOrderHandler(),
new LargeDomesticOrderHandler(),
};
}
public void Process (OrderStatusMessage orderStatusMessage,
Order order) {
// Apply the changes to the Order from the OrderStatusMessage
updateTheOrder(order);
// Find the first IOrderHandler that "knows" how
// to process this Order
IOrderHandler handler =
Array.Find(_handlers, h => h.CanProcess(order));
handler.ProcessOrder(order);
}
private void updateTheOrder(Order order) {
}
}
http://msdn.microsoft.com/en-us/magazine/cc546578.aspx