Search code examples
c#visual-studiooverridingresharperdispose

Why is this overridden method grayified?


In the code I have to maintain ("Lucky Man" by ELP definitely does not fit this soundtrack), I see this, grayed out (not commented out -- grayed out by the compiler or Resharper):

protected override void Dispose( bool disposing )
{
    base.Dispose( disposing );
}

An orange light bulb glyph (Resharper?) msg says about it, "Remove redundant method override"

A skyblue circular glyph with a "0" inside says:

"Overrides method from class 'System.ComponentModel.Component" -and: "Overrides method from class 'System.Windows.Forms.Control"

I take it what it is saying is that this override does nothing beyond what the method it's overriding does, and thus I can remove it entirely. Am I right?


Solution

  • Since you're just calling the base method, there's no reason for that code to be there, hence it can be removed.