3 Part Format of Numbers in C#

What is a 3 part format?

The 3 part format is used to show a positive, negative and zero value number. The string format has three parts. The first part corresponds to the positive test and the second part corresponds to negative test. The last part is for when the value is zero.


In the above example, the formatting string is the 3 part format. As you see each part is separated with a semicolon (;).

Using the Format

It’s very easy to use. It can be used with ToString() method overload.

The following output values are shown when debugging above code.

Positive Number

Negative Number

No Value (0)

Hope this post is useful.

Thanks for reading. Like Method Of Tried in Facebook.