I'm using the following code, but when I send ex: '10 .100 'to 2 houses it returns '10 .1', but should be '10 .10 '
public decimal TruncarDecimal(decimal value, int decimalPlaces)
{
decimal integralValue = Math.Truncate(value);
decimal fraction = value - integralValue;
decimal factor = (decimal)Math.Pow(10, decimalPlaces);
decimal truncatedFraction = Math.Truncate(fraction * factor) / factor;
decimal result = integralValue + truncatedFraction;
return result;
}