【发布时间】:2010-09-18 05:26:41
【问题描述】:
在IDisposable.Dispose 方法中是否有办法判断是否抛出异常?
using (MyWrapper wrapper = new MyWrapper())
{
throw new Exception("Bad error.");
}
如果using 语句中抛出异常,我想知道在处置IDisposable 对象时。
【问题讨论】:
-
为什么你的实现 IDisposable 的包装器需要知道为什么要处理它?
-
我想写一条日志消息,想知道语句里面的代码是运行成功还是中途因为异常而爆发了。
-
看看这个来自ayende ayende.com/Blog/archive/2007/06/20/…
标签: c# .net idisposable