c# - Why does decimal min value not convert to a string? -


the following console app crashes:

decimal dec = decimal.minvalue; string str = string.format("{0:d}", dec);  console.writeline(str); 

the error is:

format specifier invalid. 

given i'm formatting decimal decimal, wrong this?

from the documentation:

this format supported integral types.

decimal isn't integral type.

the fact format type called "decimal" unfortunate, basically. it's because formats integers in base 10, it's not directly related decimal type.

i suspect want f, g or n (or possibly else, based on actual requirements, aren't clear).


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -