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

GetFieldsInternal() private method

private GetFieldsInternal ( BindingFlags bf, MonoGenericClass reftype ) : System.Reflection.FieldInfo[]
bf BindingFlags
reftype MonoGenericClass
return System.Reflection.FieldInfo[]
		FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype)
		{
			FieldInfo[] fields = GetFieldsFromGTD (bf);
			if (fields.Length == 0)
				return new FieldInfo [0];

			ArrayList l = new ArrayList ();
			bool match;
			FieldAttributes fattrs;

			initialize ();

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

				match = false;
				fattrs = c.Attributes;
				if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
					if ((bf & BindingFlags.Public) != 0)
						match = true;
				} else {
					if ((bf & BindingFlags.NonPublic) != 0)
						match = true;
				}
				if (!match)
					continue;
				match = false;
				if ((fattrs & FieldAttributes.Static) != 0) {
					if ((bf & BindingFlags.Static) != 0)
						match = true;
				} else {
					if ((bf & BindingFlags.Instance) != 0)
						match = true;
				}
				if (!match)
					continue;
				l.Add (TypeBuilder.GetField (this, c));
			}

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

Usage Example

Esempio n. 1
0
        public override FieldInfo[] GetFields(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.GetFieldsInternal(bf, this));
                }
                else
                {
                    if (!(type is TypeBuilder))
                    {
                        break;
                    }
                    arrayList.AddRange(type.GetFields(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.GetFields_internal(bf, this));
Block_4:
IL_8F:
            FieldInfo[] array = new FieldInfo[arrayList.Count];
            arrayList.CopyTo(array);
            return(array);
        }
All Usage Examples Of System.Reflection.MonoGenericClass::GetFieldsInternal