catch Block
noun
say it: “KACH blok” /kætʃ blɒk/
A block that runs when its try block throws a matching exception, to handle it.
What is catch Block in C#?
catch Block — A block that handles a matching exception from its try block.
class OrderReader
{
int ReadQuantity(string text)
{
try
{
return int.Parse(text);
}
catch (FormatException)
{
return 0;
}
}
}
In a sentence
- “The catch block showed "File not found" instead of crashing.”
Level: Journeyman · More C# terms at this level
Updated