編譯器錯誤 CS0244
更新:2007 年 11 月
錯誤訊息
'is' 或 'as' 在指標型別上都無效
在指標型別 (Pointer Type) 上使用 is 和 as 關鍵字是無效的。如需詳細資訊,請參閱Unsafe 程式碼和指標 (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);
}
}