This documentation is archived and is not being maintained.

Compiler Error CS0244

"is" or "as" are not valid on pointer types

The is and as keywords are not valid for use on pointer types.

The following sample generates CS0244:

// CS0244.cs
// compile with: /unsafe
using System;

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);
   }
}
Show: