Skip to content
David Cumps
Exam 70-536 study notes

Delegate Class

Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).

Overview

  • Holds a reference to a method.
  • Declared in a single line; the framework provides the underlying implementation.

Good practice

  • A delegate used for events should take 2 parameters: an object sender and the event arguments.
  • You should derive from EventArgs to supply custom event data.

Examples

Simple Delegate

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

You May Also Like