-3

I want decimal value to two precision output like below input,

  1. 0
  2. 78.8798
  3. 6
  4. 0.986

to

  1. 0.00
  2. 78.88
  3. 6.00
  4. 0.99

in c# decimal value to decimal or string.

Thomas Ayoub
  • 28,235
  • 15
  • 95
  • 135

1 Answers1

6

One way:

String.Format("{0:0.00}", yourDecimal)

Read: Custom Numeric Format Strings

Tim Schmelter
  • 429,027
  • 67
  • 649
  • 891