How do I display a decimal value to 2 decimal places in c#?

 How do I display a decimal value to 2 decimal places in c#?

Round a double value to 2 decimal places

 

Double value = 1000.123456;
Double value1 = Math.Round((Double)value, 2);

OutPut

1000.12

 

 

decimal value = 1000.123456M;
MessageBox.Show(value.ToString("#.##"));

OutPut

1000.12

decimal value = 1000.123456M;
MessageBox.Show(String.Format("{0:0.00}", value));

OutPut

1000.12

 

 

 

2021-10-03