Custom numeric format string to always display the sign

Yes, you can.
There is conditional formatting. See Conditional formatting in MSDN

eg:

string MyString = number.ToString("+0;-#");

Where each section separated by a semicolon represents positive and negative numbers

or:

string MyString = number.ToString("+#;-#;0");

if you don’t want the zero to have a plus sign.

Leave a Comment