Currently i am creating an extension method that accepts parameters. Using the below example, how could one convert this using lambda expressions?
public static decimal ChangePercentage(this IEnumerable<Trade> trades, DateTime startDate, DateTime endDate)
{
var query = from trade in trades
where trade.TradeTime >= startDate
where trade.TradeTime <= endDate
orderby trade.TradeTime descending
select trade;
return (query.First().Value - query.Last().Value) / query.First().Value * 100;
}
What are the pro/cons using lambda vs normal method parameters?
Thanks