我很想知道是否應該最小化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