using(SomeClass x = new SomeClass("c:/temp/test.txt"))
{
...
}
在 using 块内,一切正常,可以正常处理异常。但是如果构造函数SomeClass
可以抛出异常吗?
将您的使用放入 try catch fe 中。
try
{
using(SomeClass x = new SomeClass("c:/temp/test.txt"))
{
...
}
}
catch(Exception ex)
{
...
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)