C#C
C#4y ago
surwren

exception subclass for try-catch block [Answered]

I want to subclass Exceptions to create a class that can be inserted into a catch() parameter to detect errors.

(Say for example I want an exception class that can detect if a triangle is valid)

I looked through the microsoft libraries' source code for some inkling of a conditional that logically allows for something like catch(DivideByZeroException) but could not find anything that made sense to me.

I'm dumbfounded. Without conditionals, how else does catch() detect which exception is being thrown?
Was this page helpful?