// A generic method to transform one sequence into another:
delegate Tout Action(Tin element);
IEnumerable Transform(IEnumerable list, Action method)
{
foreach (Tin entry in list)
yield return method(entry);
}
public IEnumerable<string> GetCustomerDetails()
{
var customerList =GetCustomerList();
return Transform string>(customerList,
delegate(Customer item)
{
return CreateCustomerReport(item.CustomerID, item.CustomerName, item.CustomerAddress);
});
}
delegate Tout Action
IEnumerable
{
foreach (Tin entry in list)
yield return method(entry);
}
public IEnumerable<string> GetCustomerDetails()
{
var customerList =GetCustomerList();
return Transform
delegate(Customer item)
{
return CreateCustomerReport(item.CustomerID, item.CustomerName, item.CustomerAddress);
});
}
No comments :
Post a Comment