Beispiel #1
0
        public static IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull(targetType, "targetType");
            List <PropertyInfo> propertyInfos = new List <PropertyInfo>(targetType.GetProperties(bindingAttr));

            if (targetType.IsInterface())
            {
                Type[] interfaces = targetType.GetInterfaces();
                for (int i = 0; i < (int)interfaces.Length; i++)
                {
                    propertyInfos.AddRange(interfaces[i].GetProperties(bindingAttr));
                }
            }
            ReflectionUtils.GetChildPrivateProperties(propertyInfos, targetType, bindingAttr);
            for (int j = 0; j < propertyInfos.Count; j++)
            {
                PropertyInfo item = propertyInfos[j];
                if (item.DeclaringType != targetType)
                {
                    PropertyInfo memberInfoFromType = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(item.DeclaringType, item);
                    propertyInfos[j] = memberInfoFromType;
                }
            }
            return(propertyInfos);
        }
Beispiel #2
0
        public static IEnumerable <PropertyInfo> GetProperties(
            Type targetType,
            BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull((object)targetType, nameof(targetType));
            List <PropertyInfo> propertyInfoList = new List <PropertyInfo>((IEnumerable <PropertyInfo>)targetType.GetProperties(bindingAttr));

            if (targetType.IsInterface())
            {
                foreach (Type type in targetType.GetInterfaces())
                {
                    propertyInfoList.AddRange((IEnumerable <PropertyInfo>)type.GetProperties(bindingAttr));
                }
            }
            ReflectionUtils.GetChildPrivateProperties((IList <PropertyInfo>)propertyInfoList, targetType, bindingAttr);
            for (int index = 0; index < propertyInfoList.Count; ++index)
            {
                PropertyInfo propertyInfo = propertyInfoList[index];
                if (propertyInfo.DeclaringType != targetType)
                {
                    PropertyInfo memberInfoFromType = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(propertyInfo.DeclaringType, (MemberInfo)propertyInfo);
                    propertyInfoList[index] = memberInfoFromType;
                }
            }
            return((IEnumerable <PropertyInfo>)propertyInfoList);
        }
Beispiel #3
0
        public static IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull(targetType, "targetType");
            List <PropertyInfo> propertyInfos = new List <PropertyInfo>(targetType.GetProperties(bindingAttr));

            ReflectionUtils.GetChildPrivateProperties(propertyInfos, targetType, bindingAttr);
            for (int i = 0; i < propertyInfos.Count; i++)
            {
                PropertyInfo item = propertyInfos[i];
                if (item.DeclaringType != targetType)
                {
                    PropertyInfo memberInfoFromType = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(item.DeclaringType, item);
                    propertyInfos[i] = memberInfoFromType;
                }
            }
            return(propertyInfos);
        }
        public static IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull(targetType, "targetType");
            List <PropertyInfo> list = new List <PropertyInfo>(targetType.GetProperties(bindingAttr));

            ReflectionUtils.GetChildPrivateProperties(list, targetType, bindingAttr);
            for (int i = 0; i < list.get_Count(); i++)
            {
                PropertyInfo propertyInfo = list.get_Item(i);
                if (propertyInfo.get_DeclaringType() != targetType)
                {
                    PropertyInfo propertyInfo2 = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(propertyInfo.get_DeclaringType(), propertyInfo);
                    list.set_Item(i, propertyInfo2);
                }
            }
            return(list);
        }
Beispiel #5
0
        public static IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull((object)targetType, "targetType");
            List <PropertyInfo> list = new List <PropertyInfo>((IEnumerable <PropertyInfo>)targetType.GetProperties(bindingAttr));

            ReflectionUtils.GetChildPrivateProperties((IList <PropertyInfo>)list, targetType, bindingAttr);
            for (int index = 0; index < list.Count; ++index)
            {
                PropertyInfo propertyInfo1 = list[index];
                if (propertyInfo1.DeclaringType != targetType)
                {
                    PropertyInfo propertyInfo2 = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(propertyInfo1.DeclaringType, (MemberInfo)propertyInfo1);
                    list[index] = propertyInfo2;
                }
            }
            return((IEnumerable <PropertyInfo>)list);
        }
Beispiel #6
0
        // Token: 0x06000E42 RID: 3650 RVA: 0x00052758 File Offset: 0x00050958
        public static IEnumerable <PropertyInfo> GetProperties(Type targetType, BindingFlags bindingAttr)
        {
            ValidationUtils.ArgumentNotNull(targetType, "targetType");
            List <PropertyInfo> list = new List <PropertyInfo>(targetType.GetProperties(bindingAttr));

            if (targetType.IsInterface())
            {
                foreach (Type type in targetType.GetInterfaces())
                {
                    list.AddRange(type.GetProperties(bindingAttr));
                }
            }
            ReflectionUtils.GetChildPrivateProperties(list, targetType, bindingAttr);
            for (int j = 0; j < list.Count; j++)
            {
                PropertyInfo propertyInfo = list[j];
                if (propertyInfo.DeclaringType != targetType)
                {
                    PropertyInfo value = (PropertyInfo)ReflectionUtils.GetMemberInfoFromType(propertyInfo.DeclaringType, propertyInfo);
                    list[j] = value;
                }
            }
            return(list);
        }