Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compiler Error CS0115 

Error Message

'function' : no suitable method found to override

A method was marked as an override, but the compiler found no method to override. For more information, see override (C# Reference), and Knowing When to Use Override and New Keywords (C# Programming Guide).

Example

The following sample generates CS0115. You can resolve CS0115 in one of two ways:

  • Remove the override keyword from the method in MyClass2.

  • Use MyClass1 as a base class for MyClass2.

// CS0115.cs
namespace MyNamespace
{
    abstract public class MyClass1
    {
        public abstract int f();
    }

    abstract public class MyClass2
    {
        public override int f()   // CS0115
        {
            return 0;
        }

        public static void Main()
        {
        }
    }
}
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft