How to get the row with the best number?

I read many articles about number format strings, for example: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

I really don't understand how to write a better format string. To get an excluded result, I can write several ways. Example: Type 1234567890 as the text "1,234,567,890". These methods give the same result:

1234567890.ToString("#,#") 1234567890.ToString("#,##") 

"#, ##" is popular on the Internet, but why? Please give me information on how to write a good format string. Thanks.

+6
source share
2 answers

As far as I can see, there is no difference between "#,#" and "#,##" : both mean "format a number with group delimiters and without fractional part". For more information, see the SSCLI source for formatting a common number .

+1
source

In your case, it does not matter because you are using int . This format #,## and #,# is for doubles and means that only print two digits after the decimal point

0
source

Source: https://habr.com/ru/post/948519/


All Articles