main
 1using System;
 2
 3namespace jive
 4{
 5  public static class NumericConversions
 6  {
 7    public static int to_int<T>(this T item) where T : IConvertible
 8    {
 9      return Convert.ChangeType(item, typeof (int)).downcast_to<int>();
10    }
11
12    public static long to_long<T>(this T item) where T : IConvertible
13    {
14      return Convert.ChangeType(item, typeof (long)).downcast_to<long>();
15    }
16
17    public static double to_double<T>(this T item) where T : IConvertible
18    {
19      return Convert.ChangeType(item, typeof (double)).downcast_to<double>();
20    }
21  }
22}