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;
}
}
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: