我收到错误消息“当我在事件处理程序中调用 IsPrime 时,方法 'IsPrime' 没有重载需要 0 个参数?
public bool IsPrime(int testNum)
{
// return True if argument is prime number
// return false otherwise
// A prime number is a natural number that has exactly two divisors, 1 and the number its self.
//
if (testNum == 1) return false; // by definition of Prime numbers, 1 is not a prime
if (testNum == 2) return true; // short circuit out, we know that 2 is the first prime number
for (int i = 2; i < testNum; ++i) {
if (testNum % i == 0) return false;
}
return true;
}