Espresso.JsConvert.ToJsValue C# (CSharp) Method

ToJsValue() public method

public ToJsValue ( System.DateTime dtm ) : Espresso.JsValue
dtm System.DateTime
return Espresso.JsValue
        public JsValue ToJsValue(DateTime dtm)
        {
            return new JsValue
            {
                Type = JsValueType.Date,
                Num = Convert.ToInt64(dtm.Subtract(EPOCH).TotalMilliseconds)
                /*(((DateTime)obj).Ticks - 621355968000000000.0 + 26748000000000.0)/10000.0*/
            };
        }

Same methods

JsConvert::ToJsValue ( INativeScriptable jsInstance ) : Espresso.JsValue
JsConvert::ToJsValue ( bool value ) : Espresso.JsValue
JsConvert::ToJsValue ( char c ) : Espresso.JsValue
JsConvert::ToJsValue ( decimal value ) : Espresso.JsValue
JsConvert::ToJsValue ( double value ) : Espresso.JsValue
JsConvert::ToJsValue ( float value ) : Espresso.JsValue
JsConvert::ToJsValue ( int value ) : Espresso.JsValue
JsConvert::ToJsValue ( long value ) : Espresso.JsValue
JsConvert::ToJsValue ( object arr ) : Espresso.JsValue
JsConvert::ToJsValue ( string value ) : Espresso.JsValue

Usage Example

コード例 #1
0
        internal void KeepAliveDeleteProperty(int slot, string name, ref JsValue output)
        {
#if DEBUG_TRACE_API
            Console.WriteLine("deleting prop " + name);
#endif
            // TODO: This is pretty slow: use a cache of generated code to make it faster.
            var obj = KeepAliveGet(slot);
            if (obj == null)
            {
                output.Type = JsValueType.Error;
                output.I64  = (int)JsManagedError.NotFoundManagedObjectId;
                return;
            }

#if DEBUG_TRACE_API
            Console.WriteLine("deleting prop " + name + " type " + type);
#endif

            if (typeof(IDictionary).ExtIsAssignableFrom(obj.GetType()))
            {
                IDictionary dictionary = (IDictionary)obj;
                if (dictionary.Contains(name))
                {
                    dictionary.Remove(name);
                    _convert.ToJsValue(true, ref output);
                    return;
                }
            }
            _convert.ToJsValue(false, ref output);
        }
All Usage Examples Of Espresso.JsConvert::ToJsValue