C
C# Learner
In the following two code blocks, DoSomethingUseful throws AnException,
while neither of the other called methods throw any exceptions. Which of
the code blocks is better (in terms of readability, maintainability, etc.),
in your opinions?
A
{
Start();
try
{
DoSomethingUseful();
}
catch (AnException e)
{
throw e;
}
Finish();
}
B
{
try
{
Start();
DoSomethingUseful();
Finish();
}
catch (AnException e)
{
throw e;
}
}
while neither of the other called methods throw any exceptions. Which of
the code blocks is better (in terms of readability, maintainability, etc.),
in your opinions?
A
{
Start();
try
{
DoSomethingUseful();
}
catch (AnException e)
{
throw e;
}
Finish();
}
B
{
try
{
Start();
DoSomethingUseful();
Finish();
}
catch (AnException e)
{
throw e;
}
}