Skip to content
David Cumps

Delegate Class

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

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);

You May Also Like

ArrayList Class

Resizeable, unordered, index-based collection. Suffers from boxing/unboxing when working with value types. Implements IEnumerator, allowing foreach…

BitArray Class

Contains an array of true/false values. Resizable through the Length property. Supports bitwise operations.