using System;
using System.Linq;
public class Program
{
public static void Main()
double[] tests = new double[] {
1.0,
1123.1,
1123.0,
1122.9,
1122.1,
1122.0,
1121.5,
};
foreach (var item in tests)
Console.WriteLine(item + " -> " + RoundToNearestEven(item));
}
private static long RoundToNearestEven(double value)
return (long)value + (long)value % 2;