convert double to int
You can use a cast if you want the default truncate-towards-zero behaviour. Alternatively, you might want to use Math.Ceiling, Math.Round, Math.Floor etc – although you’ll still need a cast afterwards. Don’t forget that the range of int is much smaller than the range of double. A cast from double to int won’t throw an exception … Read more