Delegate Class

Overview

  • Holds a reference to a method.
  • Declared as a single line, the framework provides the underlying implementation.

Good practice

  • A delegate should contain 2 parameters, an object sender and event arguments.
  • You should derive from EventArgs to supply custom event data.

Examples

Simple Delegate

public delegate void MyEventHandler(object sender, EventArgs e);