public static double ConvertNumber(object from)
{
if (from is double) return (double)from;
if (from is float) return Convert.ToDouble((float)from);
if (from is int) return Convert.ToDouble((int)from);
if (from is uint) return Convert.ToDouble((uint)from);
if (from is long) return Convert.ToDouble((long)from);
if (from is ulong) return Convert.ToDouble((ulong)from);
throw new ArgumentException(string.Format("Not a number [{0}]", from), "from");
}
}