In C#, the result of Math.Round(2.5) is 2.
Math.Round(2.5)
It is supposed to be 3, isn\'t it? Why is it 2 instead in C#?
using a custom rounding
public int Round(double value) { double decimalpoints = Math.Abs(value - Math.Floor(value)); if (decimalpoints > 0.5) return (int)Math.Round(value); else return (int)Math.Floor(value); }