== Why is this an issue?

Overriding a method just to call the same method from the base class without performing any other actions is useless and misleading. The only time this is justified is in ``++sealed++`` overriding methods, where the effect is to lock in the parent class behavior. This rule ignores overrides of ``++Equals++`` and ``++GetHashCode++``.


NOTE++:++ In some cases it might be dangerous to add or remove empty overrides, as they might be breaking changes.

=== Noncompliant code example

[source,csharp]
----
public override void Method() // Noncompliant
{
  base.Method(); 
}
----

=== Compliant solution

[source,csharp]
----
public override void Method()
{
  //do something else
}
----

=== Exceptions

If there is an attribute in any level of the overriding chain, then the overridden member is ignored.


[source,csharp]
----
public class Base
{
  [Required]
  public virtual string Name { get; set; }
}

public class Derived : Base
{
  public override string Name
  {
    get 
    { 
      return base.Name; 
    }
    set 
    { 
      base.Name = value; 
    }
  }
}
----

If there is a documentation comment on the overriding method, it will be ignored:


[source,csharp]
----
public class Foo : Bar
{
    /// <summary>
    /// Keep this method for backwards compatibility.
    /// </summary>
    public override void DoSomething()
    {
        base.DoSomething();
    }
}
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this [method|property] "XXXX" to simply inherit its behavior.


'''
== Comments And Links
(visible only on this page)

=== on 7 Apr 2017, 09:53:45 Valeri Hristov wrote:
See the following blog post for additional information about breaking changes:

https://blogs.msdn.microsoft.com/ericlippert/2010/03/29/putting-a-base-in-the-middle/



include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
