Exception

noun

say it: “ek-SEP-shun” /ɪkˈsɛpʃən/

An object describing an error that stops the normal flow of the program until something catches it.

What is Exception in C#?

Exception — An object describing a problem that interrupts normal program flow.

class Reservation
{
    void Reserve(int seats)
    {
        if (seats < 1)
        {
            throw new ArgumentException("Seat count must be positive");
        }
    }
}

In a sentence

  • “Opening a missing file threw an exception, FileNotFoundException.”

Level: Journeyman · More C# terms at this level

Updated

In other subjects