Skip to main content

How to Resolve Error "CS0072: 'event' : cannot override; 'method' is not an event" in C#

The Compiler Error CS0072 is an inheritance mismatch error. The message reads: "'Child.Member' : cannot override; 'Parent.Member' is not an event".

In C#, when you use the override keyword, the member in the derived (child) class must match the member type in the base (parent) class exactly. You can only override a method with a method, a property with a property, and an event with an event. This error occurs when you try to define an event that overrides a base member that is actually a method or a property.

This guide explains how to resolve this naming or type conflict.

Understanding Override Consistency​

Polymorphism in C# relies on strict signatures. If a base class defines a virtual method void DoWork(), the runtime expects any override to also be a method with the signature void DoWork().

If you declare public override event EventHandler DoWork, the compiler sees a fundamental conflict: "The parent says DoWork is a function I can call, but the child says DoWork is a subscription list." These two concepts are incompatible in the Virtual Method Table (vtable).

Scenario: Overriding a Method with an Event​

This often happens when developers confuse standard naming conventions, such as confusing the event itself (Click) with the method that raises it (OnClick).

In this example, the parent class defines a method named OnChanged. The child class mistakenly tries to turn OnChanged into an event.

using System;

public class BaseClass
{
// This is a METHOD
public virtual void OnChanged()
{
Console.WriteLine("Base changed.");
}
}

public class DerivedClass : BaseClass
{
// ⛔️ Error CS0072: 'DerivedClass.OnChanged': cannot override;
// 'BaseClass.OnChanged' is not an event.
public override event EventHandler OnChanged;
}

Solution 1: Rename the Event​

If your intention was to introduce a new event, do not try to override the existing method. Give the event a unique name. Usually, events are named verbs (e.g., Changed), and the methods that raise them are named On[EventName] (e.g., OnChanged).

public class DerivedClass : BaseClass
{
// ✅ Correct: A new event with a distinct name.
// We removed 'override' because this is a new member, not a replacement.
public event EventHandler Changed;

// Optionally, we can override the method to raise our new event
public override void OnChanged()
{
base.OnChanged();
Changed?.Invoke(this, EventArgs.Empty);
}
}

Solution 2: Override the Correct Member Type​

If your intention was to hook into the logic of the parent class, you should keep the member as a method, not change it to an event.

public class DerivedClass : BaseClass
{
// ✅ Correct: Overriding a Method with a Method
public override void OnChanged()
{
Console.WriteLine("Derived logic running...");
base.OnChanged();
}
}

Conclusion​

CS0072 enforces that you cannot change the "kind" of a member when overriding it.

  1. Check the Base Class: Look at the definition of the member you are trying to override. Is it a void Method() or an event?
  2. Align the Child Class:
    • If the base is a method, your override must be a method.
    • If you want an event, declare a new event with a different name (don't use override).