示例#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;
 }
示例#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);
 }