I have the following code:
var voucherAmountValue = "5";
var totalValue = Math.Round(Convert.ToDecimal(voucherAmountValue), 2);
When I write totalValue
to the console, it prints 5
. I'd expect the fractional digits to be added, printing 5.00
for totalValue
, but it doesn't: it still prints 5
.
How can I add the fractional digits to a decimal that doesn't have them?