using System; namespace jive { public static class NumericConversions { public static int to_int(this T item) where T : IConvertible { return Convert.ChangeType(item, typeof (int)).downcast_to(); } public static long to_long(this T item) where T : IConvertible { return Convert.ChangeType(item, typeof (long)).downcast_to(); } public static double to_double(this T item) where T : IConvertible { return Convert.ChangeType(item, typeof (double)).downcast_to(); } } }