Allows specification of conditions along with a catch block. The catch block is only executed if the condition satisfies.
how to use
To handle exception with a “specific condition”, add expression which evaluates to true following when or if keywords.
note
A Fundamental difference when compared with traditional exception handling. If your condition is in the catch block, you are catching the exception and then checking the condition,while with Exception Filters you are checking the condition before catching the exception.
If the condition is not satisfied, the catch block is skipped and the code moves to check if there are other catch blocks matching the exception.
note 2
Expressions such as a log function evaluating to false allows logging of all exceptions (and will fall through to more specific handling).