Compiler Error CS0242
The operation in question is undefined on void pointers
Incrementing a void pointer is not allowed. For more information, see Unsafe Code and Pointers.
The following sample generates CS0242:
// CS0242.cs
// compile with: /unsafe
class TestClass
{
public unsafe void Test()
{
void * p = null;
p++; // CS0242, incrementing a void pointer not allowed
}
public static void Main()
{
}
}
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: