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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -