System.Linq.Expressions.Expression.FindInstanceProperty C# (CSharp) Method

FindInstanceProperty() private static method

The method finds the instance property with the specified name in a type. The property's type signature needs to be compatible with the arguments if it is a indexer. If the arguments is null or empty, we get a normal property.
private static FindInstanceProperty ( Type type, string propertyName, Expression arguments ) : PropertyInfo
type Type
propertyName string
arguments Expression
return System.Reflection.PropertyInfo
        private static PropertyInfo FindInstanceProperty(Type type, string propertyName, Expression[] arguments)
        {
            // bind to public names first
            BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy;
            PropertyInfo pi = FindProperty(type, propertyName, arguments, flags);
            if (pi == null)
            {
                flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy;
                pi = FindProperty(type, propertyName, arguments, flags);
            }
            if (pi == null)
            {
                if (arguments == null || arguments.Length == 0)
                {
                    throw Error.InstancePropertyWithoutParameterNotDefinedForType(propertyName, type);
                }
                else
                {
                    throw Error.InstancePropertyWithSpecifiedParametersNotDefinedForType(propertyName, GetArgTypesString(arguments), type);
                }
            }
            return pi;
        }
Expression