My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
C# CODE EXAMPLE created on Friday, June 11, 2010 permalink
How to override events in inherited classes
This shows you how to have each inheriting class handle its own events and sent its own object back up to the subscriber.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestInheritedEvents234
{
    class Program
    {
        static void Main(string[] args)
        {
            Person person = new Person();
            person.OnDeleted += new EventHandler(person_OnDeleted);
            person.Delete();

            Customer customer = new Customer();
            customer.OnDeleted += new EventHandler(person_OnDeleted);
            customer.Delete();

            Console.ReadLine();
        }

        static void person_OnDeleted(object sender, EventArgs e)
        {
            Console.WriteLine("in main program: the object sent was a " + sender.GetType().Name);
        }
    }

    public class Person
    {
        public virtual event EventHandler OnDeleted;

        public virtual void Delete()
        {
            Console.WriteLine("inside person: deleted");
            if(OnDeleted != null)
                OnDeleted(this, null);
        }
    }

    public class Customer : Person
    {
        public override event EventHandler OnDeleted;

        public override void Delete()
        {
            Console.WriteLine("inside customer: deleted");
            if (OnDeleted != null)
                OnDeleted(this, null);
        }
    }
}
need markup?