使用英语阅读

通过


编译器错误 CS0242

相关操作在 void 指针上未定义

不允许递增 void 指针。 有关详细信息,请参阅不安全代码和指针

下面的示例生成 CS0242:

C#
// 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()  
   {  
   }  
}