Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS0505 

Error Message

'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

Community Additions

© 2015 Microsoft