You need simply enforce result string to show more zeroes if need.
var a = 20.0f;
a.ToString("00.0000", CultureInfo.InvariantCulture)
//2 digits before and 4 digits after (.)
Pay attention on fact that in your case the value may not be exactly 20.0
, but something like 20.0012
. In these cases you need to first convert it to exact 20.0
, after format it to string.
2
solved convert float to string with four numeric value [closed]