System.Reflection.MonoGenericClass.GetConstructorsInternal C# (CSharp) Method

GetConstructorsInternal() private method

private GetConstructorsInternal ( BindingFlags bf, MonoGenericClass reftype ) : System.Reflection.ConstructorInfo[]
bf BindingFlags
reftype MonoGenericClass
return System.Reflection.ConstructorInfo[]
		ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype)
		{
			ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf);
			if (ctors == null || ctors.Length == 0)
				return new ConstructorInfo [0];

			ArrayList l = new ArrayList ();
			bool match;
			MethodAttributes mattrs;

			initialize ();

			for (int i = 0; i < ctors.Length; i++) {
				ConstructorInfo c = ctors [i];

				match = false;
				mattrs = c.Attributes;
				if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
					if ((bf & BindingFlags.Public) != 0)
						match = true;
				} else {
					if ((bf & BindingFlags.NonPublic) != 0)
						match = true;
				}
				if (!match)
					continue;
				match = false;
				if ((mattrs & MethodAttributes.Static) != 0) {
					if ((bf & BindingFlags.Static) != 0)
						match = true;
				} else {
					if ((bf & BindingFlags.Instance) != 0)
						match = true;
				}
				if (!match)
					continue;
				l.Add (TypeBuilder.GetConstructor (this, c));
			}

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

Usage Example

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);
        }
All Usage Examples Of System.Reflection.MonoGenericClass::GetConstructorsInternal