Proper C multicatch syntax
I saw in Java that you can do multicatch blocks (see image)
I also looked it up on stackoverflow:
https://stackoverflow.com/questions/136035/catch-multiple-exceptions-at-once
However there seems to be several methods listed in the thread.
What's the c# convention for multicatch blocks?
Stack Overflow
Catch multiple exceptions at once?
It is discouraged to simply catch System.Exception. Instead, only the "known" exceptions should be caught.
Now, this sometimes leads to unnecessary repetitive code, for example:
try
{
...
1 Reply
We either check for individual exceptions with multiple
if
s
Or we have this