finally Block

A block that normally runs after try and catch whether an exception occurred or not.

What is finally Block in C#?

finally Block — A block that normally runs after try and catch whether an exception occurred or not.

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