Compiler Error CS0244
Neither 'is' nor 'as' is valid on pointer types
The is and as operators are not valid for use on pointer types. For more information, see Unsafe Code and Pointers.
The following sample generates CS0244:
C#
// 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);
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: