C# 6 has a new feature called \"exception filtering\"
The syntax is like this:
catch (Win32Exception exception) when (exception.NativeErrorCode == 0x
The real benefit IMO:
try { } catch (SomeException ex) if (ex.Something) { } catch (Exception ex) { // SomeException with !ex.Something is caught here // not the same as calling `throw` for !ex.Something // without filters in previous handler // less code duplication }