private static IEnumerable <PropertyInfo> GetProperties(
     Type type,
     Func <Type, IEnumerable <PropertyInfo> > propertiesFactory,
     string name,
     Func <PropertyInfo, bool> propertyFilter = null)
 {
     return(MemberFinder <PropertyInfo> .EnumerateMembers(
                type,
                propertiesFactory,
                name,
                propertyFilter,
                PropertyNotAlreadyIncluded));
 }
Пример #2
0
        private static IEnumerable <MethodInfo> GetMethods(
            Type type,
            Func <Type, IEnumerable <MethodInfo> > methodsFactory,
            string name,
            Func <MethodInfo, bool> methodFilter = null)
        {
            if (methodFilter == null)
            {
                methodFilter = m => true;
            }

            return(MemberFinder <MethodInfo> .EnumerateMembers(
                       type,
                       methodsFactory,
                       name,
                       method => !method.IsSpecialName && methodFilter.Invoke(method),
                       MethodHasNotBeenOverridden));
        }
        private static IEnumerable <FieldInfo> GetFields(
            Type type,
            Func <Type, IEnumerable <FieldInfo> > fieldsFactory,
            string name,
            Func <FieldInfo, bool> fieldFilter = null)
        {
            if (fieldFilter == null)
            {
                fieldFilter = f => true;
            }

            return(MemberFinder <FieldInfo> .EnumerateMembers(
                       type,
                       fieldsFactory,
                       name,
                       f => IsNotAutoGeneratedBackingField(f) && fieldFilter.Invoke(f),
                       FieldNotAlreadyIncluded));
        }