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