ToJsValue() public méthode

public ToJsValue ( System.DateTime dtm ) : Espresso.JsValue
dtm System.DateTime
Résultat Espresso.JsValue
Exemple #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);
        }
Exemple #2
0
        internal JsValue KeepAliveDeleteProperty(int slot, string name)
        {
#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)
            {
#if DEBUG_TRACE_API
                Console.WriteLine("deleting prop " + name + " type " + type);
#endif


#if NET20
                if (typeof(IDictionary).IsAssignableFrom(obj.GetType()))
                {
                    IDictionary dictionary = (IDictionary)obj;
                    if (dictionary.Contains(name))
                    {
                        dictionary.Remove(name);
                        return(_convert.ToJsValue(true));
                    }
                }
                return(_convert.ToJsValue(false));
#else
                if (typeof(IDictionary).GetTypeInfo().IsAssignableFrom(obj.GetType().GetTypeInfo()))
                {
                    IDictionary dictionary = (IDictionary)obj;
                    if (dictionary.Contains(name))
                    {
                        dictionary.Remove(name);
                        return(_convert.ToJsValue(true));
                    }
                }
                return(_convert.ToJsValue(false));
#endif
            }

            return(JsValue.Error(KeepAliveAdd(new IndexOutOfRangeException("invalid keepalive slot: " + slot))));
        }