Спасибо всем за помощь.
Этот код не дает того, что я ожидаю, когда делитель равен 1. Базовый класс для ExceptOne не вызывается, гиперссылка в ExceptOne не отображается,Чего мне не хватает?
base ctor2
http: // exc2.com
Writeline in finally
class Program
{
static void Main(string[] args)
{
try
{
byte y = 0;
byte x = 10;
Console.WriteLine("enter a divisor");
string s = (Console.ReadLine());
y = Convert.ToByte(s);
if (y == 1) throw new ExceptOne();
Console.WriteLine("result is {0}", x / y); ;
}
catch (System.DivideByZeroException e)
{
Console.WriteLine("exception occured {0}...", e.Message);
}
catch (ExceptOne p)
{
Console.WriteLine(p.Message +"\n"+ p.HelpLink);
}
catch (System.Exception r)
{
Console.WriteLine(r.Message + "\n" + r.HelpLink);
}
finally
{
Console.WriteLine("Writeline in finally ");
Console.ReadLine();
}
}
}
public class ExceptOne : System.Exception
{
public ExceptOne()
: base("base ctor 1 ")
{
this.HelpLink = "http://exc1.com";
Console.WriteLine("WriteLine exception 1...");
throw new Exception2();
}
}
public class Exception2 : System.Exception
{
public Exception2()
: base("base ctor2 ")
{
Console.WriteLine("WriteLine exception 2...");
this.HelpLink = "http://exc2.com";
}
}