Here's a little C# quiz for your brain bones. What will happen when the following code is executed? Explain why.
Do not compile the code, just use your gray matter.
try
{
try
{
throw new ApplicationException();
}
finally
{
throw new SystemException();
}
}
catch ( Exception ex )
{
Console.WriteLine( ex.GetType().Name );
}
This came up during a conversation last week. I wouldn't want to bet on everyone getting the correct answer, and purely on that basis alone this should probably not be a recommended practice. It's still a gem of a thought problem.