Replies: 4 comments
-
How do you know which exception was actually caught? |
Beta Was this translation helpful? Give feedback.
-
In Java the type of exception is the most common subtype of the exceptions. It's not a union in that you can't use any common members between the exception types unless they are accessible on at that most common subtype. You can achieve the same functionality today in C# with exception filtering: try {
...
}
catch (Exception ex) when (ex is Exception1 || ex is Exception2) {
...
} |
Beta Was this translation helpful? Give feedback.
-
Because you can achieve this today using exception filters in C#, we are unlikely to make a language change. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
to support Java like exception handlers, turning the following:
into:
thanks
Beta Was this translation helpful? Give feedback.
All reactions