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.
source
share