Exception Handling

Using try, catch, and related statements to respond to failures.

What is Exception Handling in C#?

Exception Handling — Using try, catch, and related statements to respond to failures.

class OrderReader
{
    int ReadQuantity(string text)
    {
        try
        {
            return int.Parse(text);
        }
        catch (FormatException)
        {
            return 0;
        }
    }
}

Level: Journeyman · More C# terms at this level

Updated

In other subjects