编译器错误 CS0244
更新:2007 年 11 月
错误消息
“is”和“as”在指针类型上都无效
在指针类型上使用 is 和 as 关键字无效。有关更多信息,请参见不安全代码和指针(C# 编程指南)。
下面的示例生成 CS0244:
// CS0244.cs
// compile with: /unsafe
class UnsafeTest
{
unsafe static void SquarePtrParam (int* p)
{
bool b = p is object; // CS0244 p is pointer
}
unsafe public static void Main()
{
int i = 5;
SquarePtrParam (&i);
}
}