How do you convert a double into the nearest int?
Use Math.round(), possibly in conjunction with MidpointRounding.AwayFromZero
Math.round()
MidpointRounding.AwayFromZero
eg:
Math.Round(1.2) ==> 1 Math.Round(1.5) ==> 2 Math.Round(2.5) ==> 2 Math.Round(2.5, MidpointRounding.AwayFromZero) ==> 3