System.Linq.Expressions.Error.InstancePropertyWithoutParameterNotDefinedForType C# (CSharp) Метод

InstancePropertyWithoutParameterNotDefinedForType() статический приватный Метод

ArgumentException with message like "Instance property '{0}' that takes no argument is not defined for type '{1}'"
static private InstancePropertyWithoutParameterNotDefinedForType ( object p0, object p1 ) : Exception
p0 object
p1 object
Результат System.Exception
        internal static Exception InstancePropertyWithoutParameterNotDefinedForType(object p0, object p1)
        {
            return new ArgumentException(Strings.InstancePropertyWithoutParameterNotDefinedForType(p0, p1));
        }
        /// <summary>

Usage Example

Пример #1
0
        /// <summary>
        /// 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.
        /// </summary>
        private static PropertyInfo FindInstanceProperty(
            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] 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, nameof(propertyName));
                }
            }
            return(pi);
        }
All Usage Examples Of System.Linq.Expressions.Error::InstancePropertyWithoutParameterNotDefinedForType
Error