private static void ValidateAccessor(Expression instance, MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection <Expression> arguments) { ContractUtils.RequiresNotNull(arguments, "arguments"); ValidateMethodInfo(method); if ((method.CallingConvention & CallingConventions.VarArgs) != 0) { throw Error.AccessorsCannotHaveVarArgs(); } if (method.IsStatic) { if (instance != null) { throw Error.OnlyStaticMethodsHaveNullInstance(); } } else { if (instance == null) { throw Error.OnlyStaticMethodsHaveNullInstance(); } RequiresCanRead(instance, "instance"); ValidateCallInstanceType(instance.Type, method); } ValidateAccessorArgumentTypes(method, indexes, ref arguments); }