Display double value without scientific notation

I have a double null value that gets values ​​from a database. It retrieves the value from the database as "1E-08". I want to show the value without scientific notice (0.00000001)

I used the following code.

double? valueFromDB=1E-08;
string doubleValue=valueFromDB.Value.Value.ToString();
string formatedString=String.Format("{0:N30}", doubleValue);

But the value of formatedString is 1E-08.

+4
source share
1 answer

You call string.Formatwith a string. This will not apply numeric formatting. Try deleting the second line:

double? valueFromDB = 1E-08;
string formattedString = String.Format("{0:N30}", valueFromDB.Value);

Or, conversely, specify the format string in the call ToStringby value:

double? valueFromDB = 1E-08;
string formattedString = valueFromDB.Value.ToString("N30");

It produces 0.000000010000000000000000000000for me.

+5
source

All Articles