GetConstructorsInternal() private method

private GetConstructorsInternal ( BindingFlags bf, MonoGenericClass reftype ) : System.Reflection.ConstructorInfo[]
bf BindingFlags
reftype MonoGenericClass
return System.Reflection.ConstructorInfo[]
Esempio n. 1
0
        public override ConstructorInfo[] GetConstructors(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.GetConstructorsInternal(bf, this));
                }
                else
                {
                    if (!(type is TypeBuilder))
                    {
                        break;
                    }
                    arrayList.AddRange(type.GetConstructors(bf));
                }
                if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
                {
                    goto Block_4;
                }
                type = type.BaseType;
                if (type == null)
                {
                    goto IL_8F;
                }
            }
            MonoType monoType = (MonoType)type;

            arrayList.AddRange(monoType.GetConstructors_internal(bf, this));
Block_4:
IL_8F:
            ConstructorInfo[] array = new ConstructorInfo[arrayList.Count];
            arrayList.CopyTo(array);
            return(array);
        }
Esempio n. 2
0
        public override ConstructorInfo[] GetConstructors(BindingFlags bf)
        {
            if (!generic_type.IsCompilerContext)
            {
                throw new NotSupportedException();
            }

            ArrayList l = new ArrayList();

            Type current_type = this;

            do
            {
                MonoGenericClass gi = current_type as MonoGenericClass;
                if (gi != null)
                {
                    l.AddRange(gi.GetConstructorsInternal(bf, this));
                }
                else if (current_type is TypeBuilder)
                {
                    l.AddRange(current_type.GetConstructors(bf));
                }
                else
                {
                    MonoType mt = (MonoType)current_type;
                    l.AddRange(mt.GetConstructors_internal(bf, this));
                    break;
                }

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

            ConstructorInfo[] result = new ConstructorInfo [l.Count];
            l.CopyTo(result);
            return(result);
        }