检查对象是否与给定类型兼容。例如,可以确定对象是否与 string 类型兼容,如下所示:

 CopyCode image复制代码
if (obj is string)
{
}

Expand 图像备注

Expand 图像示例

Expand 图像C# 语言规范

Expand image请参见