C# Error
CS0670 – Field cannot have void type
Reason for the Error & Solution
Field cannot have void type
A field was declared to be of type .
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;
}
}