If you have a method like this:
public int Foo()
{
try
{
// ...
}
catch(Exception)
{
throw;
}
}
Assuming the exception is caught in another place, is this better than just having the method without any exception handling? Or this, on the other side, causes any disadvantage?
No. This does nothing for you other than pass the exception through, which is the default behavior.
Personally, I think it’s a bad practice, as having a
try/catchsuggests that you’re doing some form of exception handling or going to do something with the exception.