So just out of curiosity I wanted to see what was special about the exception class that allowed it to be used with the keyword Throw
while a standard class is not.
The language uses System.Exception
as a base for all exceptions. This essentially means that any throwable or catchable exception shouldn't error out if you do (Exception)myExc
. This is probably because the definition of the System.Exception
class is used so that all exceptions adhere to the same interface. Because of the consistent interface, exceptions arrive with a stack trace and a meaningful message (for example), which is invaluable for logging.