CollectProperties() private static method

private static CollectProperties ( PropertyInfo property, IList collection ) : void
property System.Reflection.PropertyInfo
collection IList
return void
Exemplo n.º 1
0
        public static IEnumerable <PropertyInfo> GetPropertiesInHierarchy(
            this PropertyInfo property)
        {
            List <PropertyInfo> source = new List <PropertyInfo>()
            {
                property
            };

            PropertyInfoExtensions.CollectProperties(property, (IList <PropertyInfo>)source);
            return(source.Distinct <PropertyInfo>());
        }
Exemplo n.º 2
0
        private static void FindNextProperty(
            PropertyInfo property,
            IList <PropertyInfo> collection,
            bool getter)
        {
            MethodInfo methodInfo = getter ? property.Getter() : property.Setter();

            if (!(methodInfo != (MethodInfo)null))
            {
                return;
            }
            Type type = methodInfo.DeclaringType.BaseType();

            if (!(type != (Type)null) || !(type != typeof(object)))
            {
                return;
            }
            MethodInfo   baseMethod = methodInfo.GetBaseDefinition();
            PropertyInfo property1  = type.GetInstanceProperties().Select(p => new
            {
                p = p,
                candidateMethod = getter ? p.Getter() : p.Setter()
            }).Where(_param1 =>
            {
                if (_param1.candidateMethod != (MethodInfo)null)
                {
                    return(_param1.candidateMethod.GetBaseDefinition() == baseMethod);
                }
                return(false);
            }).Select(_param0 => _param0.p).FirstOrDefault <PropertyInfo>();

            if (!(property1 != (PropertyInfo)null))
            {
                return;
            }
            collection.Add(property1);
            PropertyInfoExtensions.CollectProperties(property1, collection);
        }