I'm trying to round a decimal number, but what normally happens is that if the number is assuming 40.40
stays in 40
, and if it's 40.60
goes up to 41
my code is as follows:
decimal price = 13224.60m;
int aux = (int) Math.Round(Convert.ToDouble(price), 0, MidpointRounding.ToEven);
as well as this code if I execute it results in 13225
, but if I change the value of price
to 13224.40
:
decimal price = 13224.40m;
int aux = (int) Math.Round(Convert.ToDouble(price), 0, MidpointRounding.ToEven);
results in 13224
, and what I want is that I always round it up, that is, in either case I round it to 13225
.
Is there any way to do that? and if there is, how would the implementation be?