© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
8 replies
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Try catch exception.
C#CC# / help
13mo ago
✅ Issue with try/catch block
C#CC# / help
10mo ago
✅ Why doesn't this try catch, catch exception.
C#CC# / help
10mo ago