GetMembers() public method

public GetMembers ( BindingFlags bindingAttr ) : System.Reflection.MemberInfo[]
bindingAttr BindingFlags
return System.Reflection.MemberInfo[]
Esempio n. 1
0
        public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
        {
            if (this.recursive)
            {
                return(new MemberInfo[0]);
            }
            MemberInfoList result = new MemberInfoList();

            if (this.isComponentScope)
            {
                MemberInfo[] mems = Globals.TypeRefs.ToReferenceContext(this.GetType()).GetMembers(bindingAttr | BindingFlags.DeclaredOnly);
                if (mems != null)
                {
                    foreach (MemberInfo mem in mems)
                    {
                        result.Add(mem);
                    }
                }
            }
            else
            {
                if (this.componentScopes != null)
                {
                    for (int i = 0, n = this.componentScopes.Count; i < n; i++)
                    {
                        GlobalScope sc = (GlobalScope)this.componentScopes[i];
                        this.recursive = true;
                        MemberInfo[] mems = null;
                        try
                        {
                            mems = sc.GetMembers(bindingAttr);
                        }
                        finally
                        {
                            this.recursive = false;
                        }
                        if (mems != null)
                        {
                            foreach (MemberInfo mem in mems)
                            {
                                result.Add(mem);
                            }
                        }
                    }
                }
                IEnumerator enu = this.field_table.GetEnumerator();
                while (enu.MoveNext())
                {
                    FieldInfo field = (FieldInfo)enu.Current;
                    result.Add(field);
                }
            }
            if (this.parent != null && (this.isComponentScope || ((bindingAttr & BindingFlags.DeclaredOnly) == 0)))
            {
                this.recursive = true;
                MemberInfo[] mems = null;
                try
                {
                    mems = ((ScriptObject)this.parent).GetMembers(bindingAttr);
                }
                finally
                {
                    this.recursive = false;
                }
                if (mems != null)
                {
                    foreach (MemberInfo mem in mems)
                    {
                        result.Add(mem);
                    }
                }
            }
            return(result.ToArray());
        }
Esempio n. 2
0
        public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
        {
            if (this.recursive)
            {
                return(new MemberInfo[0]);
            }
            MemberInfoList list = new MemberInfoList();

            if (this.isComponentScope)
            {
                MemberInfo[] members = Globals.TypeRefs.ToReferenceContext(base.GetType()).GetMembers(bindingAttr | BindingFlags.DeclaredOnly);
                if (members != null)
                {
                    foreach (MemberInfo info in members)
                    {
                        list.Add(info);
                    }
                }
            }
            else
            {
                if (this.componentScopes != null)
                {
                    int num   = 0;
                    int count = this.componentScopes.Count;
                    while (num < count)
                    {
                        GlobalScope scope = (GlobalScope)this.componentScopes[num];
                        this.recursive = true;
                        MemberInfo[] infoArray2 = null;
                        try
                        {
                            infoArray2 = scope.GetMembers(bindingAttr);
                        }
                        finally
                        {
                            this.recursive = false;
                        }
                        if (infoArray2 != null)
                        {
                            foreach (MemberInfo info2 in infoArray2)
                            {
                                list.Add(info2);
                            }
                        }
                        num++;
                    }
                }
                IEnumerator enumerator = base.field_table.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    FieldInfo current = (FieldInfo)enumerator.Current;
                    list.Add(current);
                }
            }
            if ((base.parent != null) && (this.isComponentScope || ((bindingAttr & BindingFlags.DeclaredOnly) == BindingFlags.Default)))
            {
                this.recursive = true;
                MemberInfo[] infoArray3 = null;
                try
                {
                    infoArray3 = base.parent.GetMembers(bindingAttr);
                }
                finally
                {
                    this.recursive = false;
                }
                if (infoArray3 != null)
                {
                    foreach (MemberInfo info4 in infoArray3)
                    {
                        list.Add(info4);
                    }
                }
            }
            return(list.ToArray());
        }