当前位置: 首页>>代码示例>>C#>>正文


C# JsDictionaryObject.ToNumber方法代码示例

本文整理汇总了C#中JsDictionaryObject.ToNumber方法的典型用法代码示例。如果您正苦于以下问题:C# JsDictionaryObject.ToNumber方法的具体用法?C# JsDictionaryObject.ToNumber怎么用?C# JsDictionaryObject.ToNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsDictionaryObject的用法示例。


在下文中一共展示了JsDictionaryObject.ToNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUTCFullYearImpl

 /// <summary>
 /// 15.9.5.41
 /// </summary>
 /// <param name="target"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public JsInstance SetUTCFullYearImpl(JsDictionaryObject target, JsInstance[] parameters)
 {
     if (parameters.Length == 0)
         throw new ArgumentException("There was no year specified");
     DateTime valueOf = CreateDateTime(target.ToNumber());
     valueOf = valueOf.AddYears(-valueOf.Year);
     valueOf = valueOf.AddYears((int)parameters[0].ToNumber());
     target.Value = valueOf;
     if (parameters.Length > 1)
     {
         JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
         parameters.CopyTo(innerParams, 1);
         target = (JsDate)SetMonthImpl(target, innerParams);
     }
     return target;
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:22,代码来源:JsDateConstructor.cs

示例2: SetHoursImpl

 /// <summary>
 /// 15.9.5.35
 /// </summary>
 /// <param name="target"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public JsInstance SetHoursImpl(JsDictionaryObject target, JsInstance[] parameters)
 {
     if (parameters.Length == 0)
         throw new ArgumentException("There was no hour specified");
     DateTime valueOf = CreateDateTime(target.ToNumber()).ToLocalTime();
     valueOf = valueOf.AddHours(-valueOf.Hour);
     valueOf = valueOf.AddHours(parameters[0].ToNumber());
     target.Value = valueOf;
     if (parameters.Length > 1)
     {
         JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
         parameters.CopyTo(innerParams, 1);
         target = (JsDate)SetMinutesImpl(target, innerParams);
     }
     return target;
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:22,代码来源:JsDateConstructor.cs

示例3: SetUTCDateImpl

 /// <summary>
 /// 15.9.5.37
 /// </summary>
 /// <param name="target"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public JsInstance SetUTCDateImpl(JsDictionaryObject target, JsInstance[] parameters)
 {
     if (parameters.Length == 0)
         throw new ArgumentException("There was no date specified");
     DateTime valueOf = CreateDateTime(target.ToNumber());
     valueOf = valueOf.AddDays(-valueOf.Day);
     valueOf = valueOf.AddDays(parameters[0].ToNumber());
     target.Value = valueOf;
     return target;
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:16,代码来源:JsDateConstructor.cs

示例4: GetUTCMillisecondsImpl

        /// <summary>
        /// 15.9.5.25
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance GetUTCMillisecondsImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New(CreateDateTime(target.ToNumber()).ToUniversalTime().Millisecond);
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例5: SetUTCMillisecondsImpl

        /// <summary>
        /// 15.9.5.29
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance SetUTCMillisecondsImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (parameters.Length == 0)
                throw new ArgumentException("There was no millisecond specified");

            DateTime valueOf = CreateDateTime(target.ToNumber());
            valueOf = valueOf.AddMilliseconds(-valueOf.Millisecond);
            valueOf = valueOf.AddMilliseconds(parameters[0].ToNumber());
            target.Value = New(valueOf).ToNumber();
            return target;
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:17,代码来源:JsDateConstructor.cs

示例6: GetMinutesImpl

        /// <summary>
        /// 15.9.5.20
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance GetMinutesImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().Minute);
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例7: ToUTCStringImpl

        /// <summary>
        /// 15.9.5.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance ToUTCStringImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.StringClass.New(double.NaN.ToString());
            }

            return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToString(JsDate.FORMATUTC, CultureInfo.InvariantCulture));
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例8: GetTimeImpl

        /// <summary>
        /// 15.9.5.9
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance GetTimeImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New(CreateDateTime(target.ToNumber()).TimeOfDay.Ticks / JsDate.TICKSFACTOR);
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例9: GetUTCDayImpl

        /// <summary>
        /// 15.9.5.17
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance GetUTCDayImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New((int)CreateDateTime(target.ToNumber()).ToUniversalTime().DayOfWeek);
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例10: ToLocaleTimeStringImpl

        /// <summary>
        /// 15.9.5.7
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance ToLocaleTimeStringImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.StringClass.New(double.NaN.ToString());
            }

            return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().ToString(JsDate.TIMEFORMAT));
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例11: ValueOfImpl

        /// <summary>
        /// 15.9.5.8
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance ValueOfImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New(target.ToNumber());
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例12: ToLocaleStringImpl

        /// <summary>
        /// 
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance ToLocaleStringImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.StringClass.New(double.NaN.ToString());
            }

            return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().ToString("F", CultureInfo.CurrentCulture));
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:15,代码来源:JsDateConstructor.cs

示例13: SetUTCMonthImpl

 /// <summary>
 /// 15.9.5.39
 /// </summary>
 /// <param name="target"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public JsInstance SetUTCMonthImpl(JsDictionaryObject target, JsInstance[] parameters) {
     if (parameters.Length == 0)
         throw new ArgumentException("There was no month specified");
     DateTime valueOf = CreateDateTime(target.ToNumber());
     valueOf = valueOf.AddMonths(-valueOf.Month);
     valueOf = valueOf.AddMonths((int)parameters[0].ToNumber() + 1);
     target.Value = valueOf;
     if (parameters.Length > 1) {
         JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
         Array.Copy(parameters, 1, innerParams, 0, innerParams.Length);
         target = (JsDate)SetDateImpl(target, innerParams);
     }
     return target;
 }
开发者ID:925coder,项目名称:ravendb,代码行数:20,代码来源:JsDateConstructor.cs

示例14: SetSecondsImpl

 /// <summary>
 /// 15.9.5.30
 /// </summary>
 /// <param name="target"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public JsInstance SetSecondsImpl(JsDictionaryObject target, JsInstance[] parameters) {
     if (parameters.Length == 0)
         throw new ArgumentException("There was no second specified");
     DateTime valueOf = CreateDateTime(target.ToNumber()).ToLocalTime();
     valueOf = valueOf.AddSeconds(-valueOf.Second);
     valueOf = valueOf.AddSeconds(parameters[0].ToNumber());
     target.Value = valueOf;
     if (parameters.Length > 1) {
         JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
         Array.Copy(parameters,1, innerParams, 0, innerParams.Length);
         target = (JsDate)SetMillisecondsImpl(target, innerParams);
     }
     return target;
 }
开发者ID:925coder,项目名称:ravendb,代码行数:20,代码来源:JsDateConstructor.cs

示例15: GetUTCMonthImpl

        /// <summary>
        /// 15.9.5.13
        /// </summary>
        /// <param name="target"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsInstance GetUTCMonthImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (double.IsNaN(target.ToNumber()))
            {
                return Global.NaN;
            }

            return Global.NumberClass.New(CreateDateTime(target.ToNumber()).Month - 1);

        }
开发者ID:pusp,项目名称:o2platform,代码行数:16,代码来源:JsDateConstructor.cs


注:本文中的JsDictionaryObject.ToNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。