IS NOT operator in C#

c#, operators

Solution

Just change the catch block to:

catch(ThreadAbortException ex)
{
}
catch(Exception ex)
{
}

so you can handle ThreadAbortExceptions and all others separately.

Problem

I can't find the "is not" operator in C#. For example I have the code below which does not work. I need to check that `err` is not of type class `ThreadAbortException`. ``` catch (Exception err) { if (err is not ThreadAbortException) { } } ```

Original source