Ejemplo n.º 1
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            object o = IsHashtable ? ((Hashtable)obj)[binder.Name] : null;

            if(o != null) {
                if(o is Hashtable || o is ArrayList)
                    result = new JsonDynamicDocument(o);
                else
                    result = o;
            } else {
                // invoke the member on the actual object, if it exists.
                MemberInfo[] mi = objType.GetMember(binder.Name);
                if(mi != null && mi.Length > 0)
                    result = objType.InvokeMember(binder.Name, BindingFlags.GetProperty | BindingFlags.GetField, null, obj, null);
                else
                    result = null;
            }

            return true;
        }
Ejemplo n.º 2
0
        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
        {
            if(IsArrayList) {
                ArrayList al = obj as ArrayList;
                result = al[(int)indexes[0]];
                if(result is Hashtable)
                    result = new JsonDynamicDocument(result);
            } else {
                result = null;
            }

            return true;
        }