Listing D
using System;
namespace Builder2
{
       public class Class1
       {
              public Class1()
              {
                    
              }
      public delegate void OnPrimeEventHandler (object sender, 
         System.EventArgs e, long num);
      public event OnPrimeEventHandler OnPrime;
      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;
      }
       }
}