Пример #1
0
        public static object InvokeStaticMethod(System.Type type, String methodName, _root.Array args)
        {
            var method = type.GetMethod(methodName);

            if (method == null)
            {
                throw new Exception("Method not found");
            }
            return(method.Invoke(null, args.ToArray()));
        }
Пример #2
0
        public _root.Array __GetDynamicNames()
        {
            var a = new _root.Array();

            foreach (KeyValuePair <object, object> pair in this)
            {
                if (pair.Key is String)
                {
                    a.push(pair.Key);
                }
            }

            return(a);
        }
Пример #3
0
        protected static IList parseArray(char[] json, ref int index, bool ordered)
        {
            IList array = new _root.Array();

            // [
            nextToken(json, ref index);

            bool done = false;

            while (!done)
            {
                int token = lookAhead(json, index);
                if (token == TOKEN_NONE)
                {
                    return(null);
                }
                else if (token == TOKEN_COMMA)
                {
                    nextToken(json, ref index);
                }
                else if (token == TOKEN_SQUARED_CLOSE)
                {
                    nextToken(json, ref index);
                    break;
                }
                else
                {
                    bool   success = true;
                    object value   = parseValue(json, ref index, ref success, ordered);
                    if (!success)
                    {
                        return(null);
                    }

                    array.Add(value);
                }
            }

            return(array);
        }