Skip to content
David Cumps

EventArgs Class

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

Overview

  • Defines the arguments to pass in an event.
  • The EventArgs class is used to raise an event without any data.

Good practice

  • Always use a class to pass event data via a delegate instead of defining separate parameters for each piece of event data.

Examples

Custom Event Arguments

public class MyEventArgs : EventArgs
{
    private string _someData;
 
    public MyEventArgs(string someEventData)
    {
        this._someData = someEventData;
    }
}

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.