1 out of 5 rated this helpful - Rate this topic

Compiler Error CS0501

'member function' must declare a body because it is not marked abstract, extern, or partial

Nonabstract methods must have implementations.

The following sample generates CS0501:

// CS0501.cs
// compile with: /target:library
public class clx
{
   public void f();   // CS0501 declared but not defined
   public void g() {}   // OK
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Another Reason for this Error Code
Another reason you may see this error code is when you're using the Automatic Properties in C#. It is quite bewildering to be told that an automatic property must declare a body, but that is what will happen if you do not have System.Core.dll as a reference in your project!
  • 12/26/2008
  • S J