【发布时间】:2010-08-23 21:31:38
【问题描述】:
我可以在运行时在方法 Helper() 中检测到程序执行是抛出异常的结果吗?
注意,我的目标是避免扩展方法 Helper() 以将异常对象作为输入参数。
public void MyFunc1()
{
try
{
// some code here that eventaully throws an exception
}
catch( Exception ex )
{
Helper();
}
}
public void MyFunc2()
{
Helper();
}
private void Helper()
{
// how can I check if program execution is the
// result of a thrown exception here.
}
【问题讨论】: