Listing C
public void IsPrime (long NumToCheck ) {
   for (long i =2; i <= Math.Sqrt(NumToCheck); i++) {
      if (NumToCheck%i == 0 ) {
         // not a prime
         return;
      }
  }
   // is a prime, fire the event
   System.EventArgs p = new System.EventArgs();
   OnPrime (this, p, NumToCheck);
   return;
}