我很想知道是否应该最小化try/catch块内部的代码,或者它确实无关紧要。在try,catch块之外运行代码有没有任何性能优势?
public bool ObjectExists(string stringTest, string againSomethingElse)
{
if(true) {}
else {} //Code here is better/worst/same
try
{
//Versus code inside try/catch block
}
catch (Exception)
{
throw;
}
}
+1 - 关于何时不抛出异常的最后一句话。 – 2009-09-23 01:36:48