Setting MidpointRounding.AwayFromZero as the default rounding method
c#
Solution
Is there a way to set the MidpointRounding.AwayFromZero to the default way to the method Math.Round(...)?
No, there isn't.
But you can write a helper method that you use everywhere which uses `MidpointRounding.AwayFromZero`.
public static class MathHelper
{
public static double Round(double value, int digits)
{
return Math.Round(value, digits, MidpointRounding.AwayFromZero);
}
}
Problem
I'm doing an app and I need to round the numbers ALWAYS using the MidpointRounding.AwayFromZero but every time I do the rounding I've to write the following statement ``` Math.Round(xxx, ddd, MidpointRounding.AwayFromZero); ``` Is there a way to set the MidpointRounding.AwayFromZero to the default way to the method Math.Round(...)?