c# - String.Format vs ToString and using InvariantCulture -


I'm a little confused here.

What should I do

  Console.WriteLine ((Val / 1085) .toString ("n"); VS Console.WriteLine (String.Format ("{0: N}", (Val / 1085)));  

How do I fit Inviteculture apart from this? In fact, I like a third form:

 

code> console.light line ("{0: N}", val / 1085);

Console.WriteLine you can String.Format for you.

Console.WriteLine does not allow you to provide culture if you want the same, you have to use the String.Format . As:

  string format (culture info. Invertorial culture, "{0: N}", 123456789);  

I do not recommend using it because international users will have trouble reading it. I'm feeling weird as 123,456,789.00 .


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -