Hi everyone. I have a Double that can have any number of points behind the decimal point. I used Math.Rounding like so:
int Rounding = 2; //The decimal place to round to.
try { MyValue = Math.Round(MyValue, Rounding); } catch { }
Now, my issue here is that if there is less than 2 decimal places, it fails. I was wondering how it is recommended that I handle that. I can't seem to figure out how to determine how many places there are behind the decimal place, so I don't know how to handle this.
Also, I wanted to ask which was better,
MyValue = Math.Round(MyValue, Rounding);
or
MyValue = Math.Round(MyValue, Rounding,MidpointRounding.AwayFromZero);
Thanks for your help.
-Matt-