© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
GameShark

❔ Catching Exceptions with generic parameters?

When adding an entity to the database, i first check if it already exists and if it does I throw an error. Now since I have alot of entities I was thinking of make an exception class that takes in a generic (the class type).

Unfortunately this doesn't work because I won't be able to catch it in my controller since I don't specify the generic.
image.png
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

Interface implementing generic parameters
C#CC# / help
2y ago
❔ How do generic parameters with static classes work?
C#CC# / help
4y ago
✅ Getting generic type parameters using reflection
C#CC# / help
3y ago
Exceptions.
C#CC# / help
17mo ago