例子:
是否可以定义我自己的异常类型?
考虑我在代码后面或 BL 或 DA 层中有自己的自定义方法:
public void my_first_method()
{
// some custom code execution..
//might throw some errors..
}
//so.. if am not wrong..
//can i have something in my event handler like..
try
{
my_first_method();
my_second_method();
my_third_method();
}
catch(my_first_methodException fex)
{
}
catch(my_second_methodException sex)
{
}
catch(my_third_methodException tex)
{
}
catch(Exception ex)
{
//if doesn't belongs to above 3 exception come here..
}
我试图找出这是否可能。请指教。提前致谢。