Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0670

Field cannot have void type

A field was declared to be of type void.

The following sample generates CS0670:

// CS0670.cs
class C
{
   void f;   // CS0670
   // try the following line instead
   // public int f;

   public static void Main()
   {
      C myc = new C();
      myc.f = 0;
   }
}
Show:
© 2014 Microsoft