System.Linq.Expressions.Error.PropertyWithMoreThanOneMatch C# (CSharp) Method

PropertyWithMoreThanOneMatch() static private method

InvalidOperationException with message like "More than one property '{0}' on type '{1}' is compatible with the supplied arguments."
static private PropertyWithMoreThanOneMatch ( object p0, object p1 ) : Exception
p0 object
p1 object
return Exception
        internal static Exception PropertyWithMoreThanOneMatch(object p0, object p1)
        {
            return new InvalidOperationException(Strings.PropertyWithMoreThanOneMatch(p0, p1));
        }
        /// <summary>

Usage Example

Beispiel #1
0
        private static PropertyInfo?FindProperty(
            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type,
            string propertyName,
            Expression[]?arguments,
            BindingFlags flags)
        {
            PropertyInfo?property = null;

            foreach (PropertyInfo pi in type.GetProperties(flags))
            {
                if (pi.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase) && IsCompatible(pi, arguments))
                {
                    if (property == null)
                    {
                        property = pi;
                    }
                    else
                    {
                        throw Error.PropertyWithMoreThanOneMatch(propertyName, type);
                    }
                }
            }

            return(property);
        }
All Usage Examples Of System.Linq.Expressions.Error::PropertyWithMoreThanOneMatch
Error