How to take away fraction part using String.Format (c#)

c#, string.format

Solution

You can use:

String.Format("{0:N0}", a); // "1"

Or, to display 1 decimal point:

String.Format("{0:N1}", a); // "1.0"

More info on Standard Numeric Format Strings.

Problem

How to take away fraction part while formatting decimal type in C#? ``` decimal a = 1.00m; String.Format("{0}", a); // result is 1.00 Should be 1, HOW? ```

Original source