C# – Conditionally catch exceptions with filtering
You can use exception filtering to conditionally catch exceptions, like this: Note: This feature was added in C# 6. Any SqlException that doesn’t meet the condition specified in the when clause will not be caught. Previously, without exception filtering, you’d have to handle that scenario in the catch block and rethrow, like this: Exception filtering … Read more