-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
  • 29,063
  • 15
  • 95
  • 142
Aamec Aamec
  • 1
  • 1
  • 9

1 Answers1

6

One way:

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

Read: Custom Numeric Format Strings

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939