C# – Round double in two decimal places in C#

cdoublerounding

I want to round up double value in two decimal places in c# how can i do that?

double inputValue = 48.485;

after round up

inputValue = 48.49;

Related: c# – How do I round a decimal value to 2 decimal places (for output on a page)

Best Answer

This works:

inputValue = Math.Round(inputValue, 2);