I want to add precision to the decimal value. For example, I have this value:
decimal number = 10;
I want to make it 10.00
. I don't want to convert it to string
like number.ToString("#.00")
Currently, I have this method:
decimal CalculatePrecision(decimal value, int precision)
{
var storedCalculated = decimal.Divide(1, Convert.ToDecimal(Math.Pow(10, precision)));
return value + storedCalculated - storedCalculated;
}
Is there any good solution for this?