示例#1
0
 /// <summary>
 /// 万能转换
 /// </summary>
 /// <param name="type"></param>
 /// <param name="arg"></param>
 /// <returns></returns>
 public static object To(Type type, object arg)
 {
     if (arg == null)
     {
         return(null);
     }
     if (type == typeof(DateTime))
     {
         return(Kit.ToDateTime(arg));
     }
     if (type == typeof(int))
     {
         return(Kit.ToInt(arg));
     }
     if (type == typeof(string))
     {
         return(arg.ToString());
     }
     if (type == typeof(double))
     {
         return(Kit.ToDouble(arg));
     }
     if (type == typeof(long))
     {
         return(Kit.ToLong(arg));
     }
     return(arg);
 }
示例#2
0
 /// <summary>
 /// 获取一串交易日的List
 /// </summary>
 /// <param name="firstDate">开始日期(int型)</param>
 /// <param name="lastDate">结束日期(int型)</param>
 /// <returns></returns>
 public static List <DateTime> GetTradeDays(int firstDate, int lastDate)
 {
     return(GetTradeDays(
                Kit.ToDateTime(firstDate, 0), //将int转换成DateTime类型
                Kit.ToDateTime(lastDate, 235959)));
 }