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

MethodNotPropertyAccessor() static private method

ArgumentException with message like "The method '{0}.{1}' is not a property accessor"
static private MethodNotPropertyAccessor ( object p0, object p1, string paramName ) : Exception
p0 object
p1 object
paramName string
return System.Exception
        internal static Exception MethodNotPropertyAccessor(object p0, object p1, string paramName)
        {
            return new ArgumentException(Strings.MethodNotPropertyAccessor(p0, p1), paramName);
        }
        /// <summary>

Same methods

Error::MethodNotPropertyAccessor ( object p0, object p1, string paramName, int index ) : Exception

Usage Example

示例#1
0
        //CONFORMING
        private static PropertyInfo GetProperty(MethodInfo mi)
        {
            Type         type  = mi.DeclaringType;
            BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic;

            flags |= (mi.IsStatic) ? BindingFlags.Static : BindingFlags.Instance;
            PropertyInfo[] props = type.GetProperties(flags);
            foreach (PropertyInfo pi in props)
            {
                if (pi.CanRead && CheckMethod(mi, pi.GetGetMethod(true)))
                {
                    return(pi);
                }
                if (pi.CanWrite && CheckMethod(mi, pi.GetSetMethod(true)))
                {
                    return(pi);
                }
            }
            throw Error.MethodNotPropertyAccessor(mi.DeclaringType, mi.Name);
        }
All Usage Examples Of System.Linq.Expressions.Error::MethodNotPropertyAccessor
Error