Ejemplo n.º 1
0
 // do the division if legal
 public double DoDivide(double a, double b)
 {
     if (b == 0)
     {
         DivideByZeroException e = new DivideByZeroException();
         e.HelpLink = "http://www.libertyassociates.com";
         throw e;
     }
     if (a == 0)
     {
         // create a custom exception instance
         MyCustomException e = new MyCustomException("Can't have zero dividend");
         e.HelpLink = "http://www.libertyassociates.com/NoZeroDividend.htm";
         throw e;
     }
     return a / b;
 }
Ejemplo n.º 2
0
 // do the division if legal
 public double DoDivide(double a, double b)
 {
     if (b == 0)
     {
         DivideByZeroException e = new DivideByZeroException();
         e.HelpLink = "http://www.libertyassociates.com";
         throw e;
     }
     if (a == 0)
     {
         // create a custom exception instance
         MyCustomException e = new MyCustomException("Can't have zero dividend");
         e.HelpLink = "http://www.libertyassociates.com/NoZeroDividend.htm";
         throw e;
     }
     return(a / b);
 }