c# - Calculate IEnumerable<decimal> with decimal without using for-loop -
i given discount percentage decimal , have ienumerable<decimal>
list of prices. want calculate discount price each 1 in linq.
ienumerable<decimal> prices = new ienumerable<decimal>() { 100, 200, 300}; decimal discountpercentage = 20;
shoot me idea, love try anything.
hope helps
ienumerable<decimal> prices = new list<decimal>() { 100, 200, 300}; decimal discountpercentage = 20; var discounted = prices.select(x=>x-x/100*discountpercentage).tolist();
Comments
Post a Comment