Skip to content
Knowledge Base
Česky

.NET Framework · Puzzle

C# Puzzle: Exceptions

Robert Haken 1 min read Markdown ↓

What is the output when you run this code?

[code lang=”csharp” light=”true”]
try
{
try
{
throw new Exception("A");
}
catch
{
throw new Exception("B");
}
finally
{
throw new Exception("C");
}
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
[/code]

See the result: https://dotnetfiddle.net/6SWPqL

Robert Haken · HAVIT Software Architect, Founder at HAVIT, Microsoft MVP - ASP.NET/IIS.
Has 53 articles in the knowledge base.
All articles by this author →
HAVIT
Read next
Discussion

Leave a reply

Discover more from HAVIT Knowledge Base

Subscribe now to keep reading and get access to the full archive.

Continue reading