無需強制轉換即可檢

如果你需要知道值的型別是擴充套件還是實現給定型別,但你不想將其實際轉換為該型別,則可以使用 is 運算子。

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