Posts

Showing posts from February, 2010

Why exceptions are expensive

  Many a times, i get to read from lots of places as, “.. don’t use generic exceptions, as they are very expensive .. instead use specific exceptions like devidebyzero .. blah .. blah ..” According to the MSDN Article from this link , it clearly states to use specific exception, but doesn’t give you as why to use specific exception. You can read my comment beneath the article . If you don’t see that, here it is. When you use the catch and cast that as generic exception, it then compares with the following set of exceptions. Which is definitely an unwanted comparison or type conversion with the exact exception that is caught and caused by the code.. Microsoft.Build.BuildEngine..::.InternalLoggerException Microsoft.Build.BuildEngine..::.InvalidProjectFileException Microsoft.Build.BuildEngine..::.InvalidToolsetDefinitionException Microsoft.Build.BuildEngine..::.RemoteErrorException Microsoft.Build.Framework..::.LoggerException Microsoft.JScript..::.CmdLineException Microsoft.JScript..