Keep Generic Value when converting to Double

I am trying to convert a generic value “170.00” to a double and I want to keep the .00 but when I try to convert it the value changes to “170”, any recommendations?

hey

try this

Double.Parse(doubVariable).ToString(".00")

regards!

1 Like

But that would be a string right? do i nedd to convert it again?

double value with .00 is equals to the same value, if you get a double value like 170.12, it will return okey because there are decimals, but 170.00 is the same value for double variable because double variable does not preserve those zeros, if you need to write it in any place you can do it with the code i’ve shared above

regards!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.