Compiler Error CS0505
'member1': cannot override because 'member2' is not a function
A class declaration attempted to override a non-method in a base class. Overrides must match the member type. If a method with the same name as a method in a base class is desired, use new (and not override) on the method declaration in the base class.
The following sample generates CS0505:
// CS0505.cs
// compile with: /target:library
public class clx
{
public int i;
}
public class cly : clx
{
public override int i() { return 0; } // CS0505
}
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: