NumberFormatInfo problem?

  • Thread starter Thread starter Pascal Cloup
  • Start date Start date
P

Pascal Cloup

Hello,

the property NumberFormatInfo.NumberDecimalDigits seems to have no effect
when converting a number. Ex:

NumberFormatInfo aNumberFormatInfo = new NumberFormatInfo();
double a=0;
string s;

aNumberFormatInfo .NumberDecimalDigits = 1;
s = a.ToString( aNumberFormatInfo );

never creates a string equal to "0.0"

Is this normal?

Thanks

Pascal
 
Hi Pascal,

Yes, it is normal.
It applies only to certain formating, such as n, N, f, F. (Number format,
Fixed-point format).
Try this:
s = a.ToString("n", aNumberFormatInfo );
 
Than you, Miha, that's ok now

Miha Markic said:
Hi Pascal,

Yes, it is normal.
It applies only to certain formating, such as n, N, f, F. (Number format,
Fixed-point format).
Try this:
s = a.ToString("n", aNumberFormatInfo );
 
Back
Top