C# exception filter?

.net, c#

Solution

Since C# 6 you can now do this.

try { … }
catch (MyException e) when (myfilter(e))
{
    …
}

This is different from using an `if` statement from within the `catch` block, using exception filters will not unwind the stack.

Problem

Does C# support compiling filters? How do filters even work or what do they do? Like reflector decompiles a filter as ``` try { } catch(Exception e) when (?) { } ```

Original source

Related problems