GetMethodsInternal() private method

private GetMethodsInternal ( BindingFlags bf, MonoGenericClass reftype ) : System.Reflection.MethodInfo[]
bf BindingFlags
reftype MonoGenericClass
return System.Reflection.MethodInfo[]
Esempio n. 1
0
        public override MethodInfo[] GetMethods(BindingFlags bf)
        {
            if (!generic_type.IsCompilerContext)
            {
                throw new NotSupportedException();
            }

            ArrayList l = new ArrayList();

            //
            // Walk up our class hierarchy and retrieve methods from our
            // parent classes.
            //

            Type current_type = this;

            do
            {
                MonoGenericClass gi = current_type as MonoGenericClass;
                if (gi != null)
                {
                    l.AddRange(gi.GetMethodsInternal(bf, this));
                }
                else if (current_type is TypeBuilder)
                {
                    l.AddRange(current_type.GetMethods(bf));
                }
                else
                {
                    // If we encounter a `MonoType', its
                    // GetMethodsByName() will return all the methods
                    // from its parent type(s), so we can stop here.
                    MonoType mt = (MonoType)current_type;
                    l.AddRange(mt.GetMethodsByName(null, bf, false, this));
                    break;
                }

                if ((bf & BindingFlags.DeclaredOnly) != 0)
                {
                    break;
                }
                current_type = current_type.BaseType;
            } while (current_type != null);

            MethodInfo[] result = new MethodInfo [l.Count];
            l.CopyTo(result);
            return(result);
        }
Esempio n. 2
0
        public override MethodInfo[] GetMethods(BindingFlags bf)
        {
            if (!this.generic_type.IsCompilerContext)
            {
                throw new NotSupportedException();
            }
            ArrayList arrayList = new ArrayList();
            Type      type      = this;

            for (;;)
            {
                MonoGenericClass monoGenericClass = type as MonoGenericClass;
                if (monoGenericClass != null)
                {
                    arrayList.AddRange(monoGenericClass.GetMethodsInternal(bf, this));
                }
                else
                {
                    if (!(type is TypeBuilder))
                    {
                        break;
                    }
                    arrayList.AddRange(type.GetMethods(bf));
                }
                if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
                {
                    goto Block_4;
                }
                type = type.BaseType;
                if (type == null)
                {
                    goto IL_91;
                }
            }
            MonoType monoType = (MonoType)type;

            arrayList.AddRange(monoType.GetMethodsByName(null, bf, false, this));
Block_4:
IL_91:
            MethodInfo[] array = new MethodInfo[arrayList.Count];
            arrayList.CopyTo(array);
            return(array);
        }