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


C# JsValue.As方法代码示例

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


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

示例1: SetUTCMonth

 private JsValue SetUTCMonth(JsValue thisObj, JsValue[] arguments)
 {
     var t = EnsureDateInstance(thisObj).PrimitiveValue;
     var m = TypeConverter.ToNumber(arguments.At(0));
     var dt = arguments.Length <= 1 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
     var newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t));
     var u = TimeClip(newDate);
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:10,代码来源:DatePrototype.cs

示例2: SetUTCFullYear

 private JsValue SetUTCFullYear(JsValue thisObj, JsValue[] arguments)
 {
     var thisTime = EnsureDateInstance(thisObj).PrimitiveValue;
     var t = double.IsNaN(thisTime) ? +0 : thisTime;
     var y = TypeConverter.ToNumber(arguments.At(0));
     var m = arguments.Length <= 1 ? MonthFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
     var dt = arguments.Length <= 2 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
     var newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t));
     var u = TimeClip(newDate);
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:12,代码来源:DatePrototype.cs

示例3: SetUTCHours

 private JsValue SetUTCHours(JsValue thisObj, JsValue[] arguments)
 {
     var t = EnsureDateInstance(thisObj).PrimitiveValue;
     var h = TypeConverter.ToNumber(arguments.At(0));
     var m = arguments.Length <= 1 ? MinFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
     var s = arguments.Length <= 2 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
     var milli = arguments.Length <= 3 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(3));
     var date = MakeDate(Day(t), MakeTime(h, m, s, milli));
     var u = TimeClip(date);
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:12,代码来源:DatePrototype.cs

示例4: SetDate

 private JsValue SetDate(JsValue thisObj, JsValue[] arguments)
 {
     var t = LocalTime(EnsureDateInstance(thisObj).PrimitiveValue);
     var dt = TypeConverter.ToNumber(arguments.At(0));
     var newDate = MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t));
     var u = TimeClip(Utc(newDate));
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:9,代码来源:DatePrototype.cs

示例5: SetMinutes

 private JsValue SetMinutes(JsValue thisObj, JsValue[] arguments)
 {
     var t = LocalTime(EnsureDateInstance(thisObj).PrimitiveValue);
     var m = TypeConverter.ToNumber(arguments.At(0));
     var s = arguments.Length <= 1 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
     var milli = arguments.Length <= 2 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
     var date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli));
     var u = TimeClip(Utc(date));
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:11,代码来源:DatePrototype.cs

示例6: SetUTCMilliseconds

 private JsValue SetUTCMilliseconds(JsValue thisObj, JsValue[] arguments)
 {
     var t = EnsureDateInstance(thisObj).PrimitiveValue;
     var time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), TypeConverter.ToNumber(arguments.At(0)));
     var u = TimeClip(MakeDate(Day(t), time));
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:Willy-Kimura,项目名称:jint,代码行数:8,代码来源:DatePrototype.cs

示例7: SetYear

        private JsValue SetYear(JsValue thisObj, JsValue[] arguments)
        {
            var thisTime = thisObj.As<DateInstance>().PrimitiveValue;
            var t = double.IsNaN(thisTime) ? +0 : LocalTime(thisTime);
            var y = TypeConverter.ToNumber(arguments.At(0));
            if (double.IsNaN(y))
            {
                thisObj.As<DateInstance>().PrimitiveValue = double.NaN;
                return double.NaN;
            }

            var fy = TypeConverter.ToInteger(y);
            if (y >= 0 && y <= 99)
            {
                fy = fy + 1900;
            }

            var newDate = MakeDay(fy, MonthFromTime(t), DateFromTime(t));
            var u = Utc(MakeDate(newDate, TimeWithinDay(t)));
            thisObj.As<DateInstance>().PrimitiveValue = TimeClip(u);
            return u;
        }
开发者ID:fatalerrorx,项目名称:jint,代码行数:22,代码来源:DatePrototype.cs

示例8: SetUTCSeconds

 private static JsValue SetUTCSeconds(JsValue thisObj, JsValue[] arguments)
 {
     var t = thisObj.As<DateInstance>().PrimitiveValue;
     var s = TypeConverter.ToNumber(arguments.At(0));
     var milli = arguments.Length <= 1 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
     var date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli));
     var u = TimeClip(date);
     thisObj.As<DateInstance>().PrimitiveValue = u;
     return u;
 }
开发者ID:fatalerrorx,项目名称:jint,代码行数:10,代码来源:DatePrototype.cs

示例9: SetTime

 private static JsValue SetTime(JsValue thisObj, JsValue[] arguments)
 {
     return thisObj.As<DateInstance>().PrimitiveValue = TimeClip(TypeConverter.ToNumber(arguments.At(0)));
 }
开发者ID:fatalerrorx,项目名称:jint,代码行数:4,代码来源:DatePrototype.cs


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