Exemple #1
0
 /// <summary>
 /// dt1-dt2的天数
 /// </summary>
 /// <param name="dt1"></param>
 /// <param name="dt2"></param>
 /// <returns></returns>
 public static DoubleStd DayDiff(DateTimeStd dt1, DateTimeStd dt2)
 {
     if (dt1 == null || dt2 == null)
     {
         return(null);
     }
     else
     {
         TimeSpan ts = dt1 - dt2;
         return(DoubleStd.ParseStd(ts.TotalDays));
     }
 }
Exemple #2
0
 /// <summary>
 /// 将Object转化成DoubleStd数据
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public static DoubleStd ParseStd(object o)
 {
     if (IsDouble(o))
     {
         DoubleStd rtn = new DoubleStd();
         rtn.Value = double.Parse(o.ToString());
         return(rtn);
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
        /// <summary>
        /// 判斷字符串是否可以转换成doubleStd类型
        /// </summary>
        /// <param name="s"></param>
        /// <param name="o1"></param>
        /// <returns></returns>
        public static bool TryParse(string s, ref DoubleStd o1)
        {
            double d;

            if (double.TryParse(s, out d))
            {
                o1.Value = d;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 判斷字符串是否可以转换成doubleStd类型
        /// </summary>
        /// <param name="s"></param>
        /// <param name="ns"></param>
        /// <param name="formatprovider"></param>
        /// <param name="o1"></param>
        /// <returns></returns>
        public static bool TryParse(string s, NumberStyles ns, IFormatProvider formatprovider, ref DoubleStd o1)
        {
            double d;

            if (o1 == null)
            {
                o1 = new DoubleStd();
            }

            if (double.TryParse(s, ns, formatprovider, out d))
            {
                o1.Value = d;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 public int CompareTo(DoubleStd other)
 {
     return(this.Value.CompareTo(other.Value));
 }