I have a null able double value which get values from data base.It retrieve value from data base as '1E-08'. I want to display the value with out scientific notification (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 still 1E-08.
You're calling string.Format
with a string. That's not going to apply numeric formatting. Try removing the second line:
double? valueFromDB = 1E-08;
string formattedString = String.Format("{0:N30}", valueFromDB.Value);
Or alternatively, specify the format string in a call to ToString
on the value:
double? valueFromDB = 1E-08;
string formattedString = valueFromDB.Value.ToString("N30");
That produces 0.000000010000000000000000000000
for me.
See more on this question at Stackoverflow