Is it possible to determine the default number format, which is used whenever I convert an integer (or double , etc.) to String without specifying a format string?
C # example:
int i = 123456; string s = "Hello " + i;
RABOR ASP.NET example:
<div> Hello @i </div>
I think all of these lines of code implicitly use the default ToString() method for Int32 . And not surprisingly, all of these lines of code lead to "Hello 123456" , but I want "Hello 123,456" .
So, can I indicate that "N0" should be used by default (at least for integer )?
I already found the question Set the default date format in C # format - it looked pretty good, but that doesn't help me for numbers.
Edit: I know that I could write an extension method that I can use throughout the application, but that is not what I am looking for. I would like to find a property (perhaps somewhere hidden in CultureInfo or NumberFormatInfo ) that is currently set to "G" and used by default as Int32.ToString() .
fero
source share