Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

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
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.