无需强制转换即可检

如果你需要知道值的类型是扩展还是实现给定类型,但你不想将其实际转换为该类型,则可以使用 is 运算符。

if(value is int)
{
   Console.WriteLine(value + "is an int");
}