Display Float as String with at Least 1 Decimal Place
I want to display a float as a string while making sure to display at least one decimal place. If there are more decimals I would like those displayed. For example: 1 should be displayed as 1.0 1.2345 should display as 1.2345 Can someone help me with the format string? Use ToString(".0###########") with as much # as decimals you want. This solution is similar to what other are saying, but I prefer to use string.Format. For example: float myFloat1 = 1.4646573654; float myFloat2 = 5; Console.WriteLine(string.Format("Number 1 : {0:0.00##}", myFloat1)); Console.WriteLine(string.Format("Number 2 :