【发布时间】:2011-01-23 17:43:51
【问题描述】:
我在 C# 中找不到“不是”运算符。
例如,我有下面的代码不起作用。我需要检查err 不是ThreadAbortException 类型。
catch (Exception err)
{
if (err is not ThreadAbortException)
{
}
}
【问题讨论】:
-
你可以这样做:If Not object.ReferenceEquals(err.GetType(), GetType(ThreadAbortException)) Then