Skip to Main Content
C# in a Nutshell, Second Edition
book

C# in a Nutshell, Second Edition

by Peter Drayton, Ben Albahari, Ted Neward
August 2003
Intermediate to advanced content levelIntermediate to advanced
928 pages
32h 1m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell, Second Edition

Name

EventInfo

Synopsis

This class allows you to access events through reflection and is, itself, an implementation of MemberInfo. Attributes gets the EventAttributes object, and EventHandlerType gets the System.Type of the event-handler delegate for the event. IsMulticast returns true if the event is multicast, and IsSpecialName indicates whether this has special meaning. AddEventHandler( ) adds the passed delegate to the event handler, and GetAddMethod( ), GetRaiseMethod( ), and GetRemoveMethod( ) return a MethodInfo for the method used to add an event handler, raise an event, or remove an event handler, respectively.

public abstract class EventInfo : MemberInfo {
// Protected Constructors
   protected EventInfo( );
// Public Instance Properties
   public abstract EventAttributes Attributes{get; }
   public Type EventHandlerType{get; }
   public bool IsMulticast{get; }
   public bool IsSpecialName{get; }
   public override MemberTypes MemberType{get; }      
// overrides MemberInfo
                  // Public Instance Methods
   public void AddEventHandler(object target, Delegate handler);
   public MethodInfo GetAddMethod( );
   public abstract MethodInfo GetAddMethod(bool nonPublic);
   public MethodInfo GetRaiseMethod( );
   public abstract MethodInfo GetRaiseMethod(bool nonPublic);
   public MethodInfo GetRemoveMethod( );
   public abstract MethodInfo GetRemoveMethod(bool nonPublic);
   public void RemoveEventHandler(object target, Delegate handler);
}

Hierarchy

System.Object MemberInfo(ICustomAttributeProvider) EventInfo

Returned By

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# in a Nutshell

C# in a Nutshell

Ben Albahari, Ted Neward, Peter Drayton
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari
C# Cookbook, 2nd Edition

C# Cookbook, 2nd Edition

Jay Hilyard, Stephen Teilhet
C# Cookbook

C# Cookbook

Joe Mayo

Publisher Resources

ISBN: 0596005261Catalog PageErrata