Guilherme Cardoso Guilherme Cardoso - 2 months ago 4x
C# Question

C# - Round numbers to 0 decimals

I need to round numbers to 0 decimals (for a pagging system).

I've already tried something like this:

Math.Round(double1, 0, MidpointRounding.AwayFromZero);

If the double1 be 7,2 or 7,6 i need it to round for 8 but i'm not getting that.

Can someone help me, please?



Use Math.Ceiling to always round up to the next integer:

double roundUp = Math.Ceiling(double1);