Spaghetti Spaghetti - 2 months ago 7
C# Question

When/Why would you use a EventHandler over just a regular Event?

Is there a difference in functionality of an using an EventHandler and just defining an Event?


These are two different things

event declares an event :

EventHandler defines the method that an event will raise:

EventHandler<TEventArgs> is a convenient wrapper for your custom EventArgs:

Different ways to subscribe to an event

using System;

namespace ConsoleApplication3
    internal class Program
        private static void Main(string[] args)
            // using a method
            MyEvent += Program_MyEvent;

            // using EventHandler, possible but not mandatory
            MyEvent += new EventHandler(Target);

            // using lambda syntax
            MyEvent += (sender, eventArgs) => { };

            // using delegate
            MyEvent += delegate (object sender, EventArgs eventArgs) { };

            // using delegate, signature is optional actually
            MyEvent += delegate { };

        private static void Target(object sender, EventArgs eventArgs)

        private static void Program_MyEvent(object sender, EventArgs e)

        public static event EventHandler MyEvent;