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

GetPropertiesInternal() private method

private GetPropertiesInternal ( BindingFlags bf, MonoGenericClass reftype ) : System.Reflection.PropertyInfo[]
bf BindingFlags
reftype MonoGenericClass
return System.Reflection.PropertyInfo[]
		PropertyInfo[] GetPropertiesInternal (BindingFlags bf, MonoGenericClass reftype)
		{
			PropertyInfo[] props = GetPropertiesInternal (generic_type, bf);
			if (props == null || props.Length == 0)
				return new PropertyInfo [0];

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

			initialize ();

			foreach (PropertyInfo pinfo in props) {
				match = false;
				accessor = pinfo.GetGetMethod (true);
				if (accessor == null)
					accessor = pinfo.GetSetMethod (true);
				if (accessor == null)
					continue;
				mattrs = accessor.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 (new PropertyOnTypeBuilderInst (reftype, pinfo));
			}
			PropertyInfo[] result = new PropertyInfo [l.Count];
			l.CopyTo (result);
			return result;
		}

Same methods

MonoGenericClass::GetPropertiesInternal ( Type type, BindingFlags bf ) : System.Reflection.PropertyInfo[]

Usage Example

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