System.Reflection.EventInfo Class

Assembly: Mscorlib.dll
Namespace: System.Reflection
Summary
Discovers the attributes of an event and provides access to event metadata.
C# Syntax:
public abstract class EventInfo : MemberInfo
Thread Safety
This type is safe for multithreaded operations.
Remarks
Events are used with delegates. An event listener instantiates an event-handler delegate that is invoked whenever the event is raised by an event source. In order to connect to the event source, the event listener adds this delegate to the invocation list on the source. When the event is raised, the invoke method of the event-handler delegate is called. Both multicast and single-cast event notifications are supported. The Add and Remove methods, as well as the event-handler delegate class associated with an event, must be marked in the metadata.

Delegates are object-oriented function pointers. In C or C++, a function pointer is a reference to a method. In contrast to the C or C++ function pointer, a delegate contains two references: a reference to a method and a reference to an object that supports the method. Delegates can invoke a method without knowing the class type that declares or inherits the method. Delegates need only know the return type and parameter list of the method.

The event model works equally well for single-cast and multicast delegates. When the delegate's invoke method is called, only a single object will have a method called on it. A multicast modifier can be applied to a delegate declaration, which allows multiple methods to be called when the invoke method of the delegate is called.

Calling ICustomAttributeProvider.GetCustomAttributes on EventInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. Use Attribute to inherit custom attributes.



Notes to inheritors: When you inherit from EventInfo, you must override the following members: EventInfo.GetAddMethod, EventInfo.GetRemoveMethod, and EventInfo.GetRaiseMethod.
See also:
System.Reflection Namespace

System.Reflection.EventInfo Member List:

Public Properties
Attributes Read-only

Gets the attributes for this event.
DeclaringType
(inherited from System.Reflection.MemberInfo)
Read-only

See base class member description: System.Reflection.MemberInfo.DeclaringType


Gets the class that declares this member.
EventHandlerType Read-only

Gets the Type object of the underlying event-handler delegate associated with this event.
IsMulticast Read-only

Gets a value indicating whether the event is multicast.
IsSpecialName Read-only

Gets a value indicating whether the EventInfo has a name with a special meaning.
MemberType Read-only

Overridden:
Gets the member type of this event.
Name
(inherited from System.Reflection.MemberInfo)
Read-only

See base class member description: System.Reflection.MemberInfo.Name


Gets the name of this member.
ReflectedType
(inherited from System.Reflection.MemberInfo)
Read-only

See base class member description: System.Reflection.MemberInfo.ReflectedType


Gets the class object that was used to obtain this instance of MemberInfo.
Public Methods
AddEventHandler Adds an event handler to an event source.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetAddMethod Overloaded:
GetAddMethod()

Returns the method used to add an event handler delegate to the event source.
GetAddMethod Overloaded:
GetAddMethod(bool nonPublic)

When overridden in a derived class, retrieves the MethodInfo object for the Add method of the event, specifying whether the method is public or nonpublic.
GetCustomAttributes
(inherited from System.Reflection.MemberInfo)
Overloaded:
GetCustomAttributes(bool inherit)

See base class member description: System.Reflection.MemberInfo.GetCustomAttributes


When overridden in a derived class, returns an array of all of the custom attributes.
GetCustomAttributes
(inherited from System.Reflection.MemberInfo)
Overloaded:
GetCustomAttributes(Type attributeType, bool inherit)

See base class member description: System.Reflection.MemberInfo.GetCustomAttributes


When overridden in a derived class, returns an array of custom attributes identified by Type.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetRaiseMethod Overloaded:
GetRaiseMethod()

Returns the method that is called when the event is raised.
GetRaiseMethod Overloaded:
GetRaiseMethod(bool nonPublic)

When overridden in a derived class, returns the method that is called when the event is raised, specifying whether the method is public or nonpublic.
GetRemoveMethod Overloaded:
GetRemoveMethod()

Returns the method used to remove an event handler delegate from the event source.
GetRemoveMethod Overloaded:
GetRemoveMethod(bool nonPublic)

When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event, specifying whether the method is public or nonpublic.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
IsDefined
(inherited from System.Reflection.MemberInfo)
See base class member description: System.Reflection.MemberInfo.IsDefined


When overridden in a derived class, indicates whether one or more instance of attributeType is defined on this member.
RemoveEventHandler Removes an event handler from an event source.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Constructors
ctor #1 Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the EventInfo class.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Reflection.EventInfo Member Details

ctor #1
Summary
Initializes a new instance of the EventInfo class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
protected EventInfo();

Return to top


Property: Attributes (read-only)
Summary
Gets the attributes for this event.
C# Syntax:
public abstract EventAttributes Attributes {get;}
Remarks
The attributes are returned in a 4-byte integer representing a bitmap of the attributes set for the event reflected by this instance.

Return to top


Property: DeclaringType (read-only)
Inherited
See base class member description: System.Reflection.MemberInfo.DeclaringType

Summary
Gets the class that declares this member.
C# Syntax:
public abstract Type DeclaringType {get;}
Remarks
The DeclaringType property retrieves a reference to the Type object for the type that declares this member. A member of a class (or interface) is either declared or inherited from a base class (or interface). The returned class might not be the same as the Type object used to obtain this MemberInfo object.
Example
The following example shows how DeclaringType works with classes and interfaces.

 interface i {
 int MyVar() ;
 };
 // DeclaringType for MyVar is i.
 
 class A : i {
 public int MyVar() { return 0; }
 };
 // DeclaringType for MyVar is A.
 
 class B : A {
 new int MyVar() { return 0; }
 };
 // DeclaringType for MyVar is B.
 
 class C : A {
 };
 // DeclaringType for MyVar is A.

    

The following example uses DeclaringType to retrieve the member names of the System.IO.BufferedStream class, along with the class in which those members are declared.

 using System;
 using System.IO;
 using System.Reflection;
 
 class Mymemberinfo { 
 
   public static void Main(string[] args) { 
 
    Console.WriteLine ("\nReflection.MemberInfo");
 
    //Get the Type and MemberInfo. 
    Type MyType =Type.GetType("System.IO.BufferedStream");
    MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
 
    //Get and display the DeclaringType method. 
    Console.Write("\nThere are {0} members in ", Mymemberinfoarray.Length); 
    Console.Write("{0}.", MyType.FullName); 
 
    foreach (MemberInfo Mymemberinfo in Mymemberinfoarray) {  
      Console.Write("\n" + Mymemberinfo.Name + " declaring type - "
        + Mymemberinfo.DeclaringType); 
    }
   }
 }

    

This code produces the following output:

Reflection.MemberInfo

There are 31 members in System.IO.BufferedStream.

WriteByte declaring type - System.IO.BufferedStream

Write declaring type - System.IO.BufferedStream

ReadByte declaring type - System.IO.BufferedStream

Read declaring type - System.IO.BufferedStream

SetLength declaring type - System.IO.BufferedStream

Seek declaring type - System.IO.BufferedStream

EndWrite declaring type - System.IO.Stream

BeginWrite declaring type - System.IO.Stream

EndRead declaring type - System.IO.Stream

BeginRead declaring type - System.IO.Stream

Flush declaring type - System.IO.BufferedStream

Close declaring type - System.IO.BufferedStream

set_Position declaring type - System.IO.BufferedStream

get_Position declaring type - System.IO.BufferedStream

get_Length declaring type - System.IO.BufferedStream

get_CanWrite declaring type - System.IO.BufferedStream

get_CanSeek declaring type - System.IO.BufferedStream

get_CanRead declaring type - System.IO.BufferedStream

InitializeLifetimeService declaring type - System.MarshalByRefObject

GetHashCode declaring type - System.Object

Equals declaring type - System.Object

ToString declaring type - System.Object

GetLifetimeService declaring type - System.MarshalByRefObject

GetType declaring type - System.Object

.ctor declaring type - System.IO.BufferedStream

.ctor declaring type - System.IO.BufferedStream

CanRead declaring type - System.IO.BufferedStream

CanWrite declaring type - System.IO.BufferedStream

CanSeek declaring type - System.IO.BufferedStream

Length declaring type - System.IO.BufferedStream

Position declaring type - System.IO.BufferedStream



Note DeclaringType returns only the member names and the names of their declaring types. To return the member names with their prototypes, call MemberInfo.ToString.

In the following code example, when B overrides virtual method M from A, it essentially redefines (or redeclares) this method. Therefore, B.M's MethodInfo reports the declaring type as B rather than A, even though A is where this method was originally declared.

class A {
    virtual public void M () {}
}
class B: A {
    override public void M () {}
}

    

Return to top


Property: EventHandlerType (read-only)
Summary
Gets the Type object of the underlying event-handler delegate associated with this event.
C# Syntax:
public Type EventHandlerType {get;}
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
.NET Framework Security:
ReflectionPermission for returning properties that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation
See also:
Type | Delegate | EventHandler

Return to top


Property: IsMulticast (read-only)
Summary
Gets a value indicating whether the event is multicast.
C# Syntax:
public bool IsMulticast {get;}
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
.NET Framework Security:
ReflectionPermission for returning properties that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation
See also:
MulticastDelegate | Type | EventHandler

Return to top


Property: IsSpecialName (read-only)
Summary
Gets a value indicating whether the EventInfo has a name with a special meaning.
C# Syntax:
public bool IsSpecialName {get;}
Remarks
This property determines whether the event's name has a special meaning. Names that begin with or contain an underscore character (_), property accessors, and operator overloading methods are examples of names that might require special treatment by some compilers.
See also:
EventAttributes

Return to top


Overridden Property: MemberType (read-only)
Summary
Gets the member type of this event.
C# Syntax:
public override MemberTypes MemberType {get;}
Remarks
Overrides MemberInfo.MemberType.
See also:
Type

Return to top


Property: Name (read-only)
Inherited
See base class member description: System.Reflection.MemberInfo.Name

Summary
Gets the name of this member.
C# Syntax:
public abstract string Name {get;}
Remarks
Only the simple name is returned, not the fully qualified name. For example, for a member System.Reflection.MemberTypes.Field, the Name property would be Field.

To get the Name property, get the class Type. From the Type, get the MemberInfo array. From a MemberInfo element of the array, obtain the Name property.

Example
This example lists the Name and DeclaringType property of each member of the System.Empty class.
using System;
using System.Reflection;
 
class Mymemberinfo
 {
    public static int Main()
    {
       Console.WriteLine ("\nReflection.MemberInfo");
       
       //Get the Type and MemberInfo.
       Type MyType = Type.GetType("System.Empty");
       MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
  
       //Get and display the DeclaringType method.
       Console.Write("\nThere are {0} members in ",
          Mymemberinfoarray.GetLength(0));
       Console.Write("{0}.", MyType.FullName);
  
       foreach (MemberInfo Mymemberinfo in Mymemberinfoarray)
       {
          Console.Write("\n" + Mymemberinfo.Name
             + " declaring type - " +
              Mymemberinfo.DeclaringType);
       }
  
       return 0;
    }
 }
 /*
 This code produces the following output:

Reflection.MemberInfo

There are 6 members in System.Empty.
Value declaring type - System.Empty
GetObjectData declaring type - System.Empty
GetHashCode declaring type - System.Object
Equals declaring type - System.Object
ToString declaring type - System.Empty
GetType declaring type - System.Object
 */

    

Return to top


Property: ReflectedType (read-only)
Inherited
See base class member description: System.Reflection.MemberInfo.ReflectedType

Summary
Gets the class object that was used to obtain this instance of MemberInfo.
C# Syntax:
public abstract Type ReflectedType {get;}
Remarks
The ReflectedType property retrieves the Type object that was used to obtain this instance of MemberInfo. A MemberInfo object represents a member of a particular class or interface.

In order to obtain a MethodInfo object:

Example
 using System;
 using System.IO;
 using System.Reflection;
 
 class Mymemberinfo { 
 
   public static void Main(string[] args) { 
 
    Console.WriteLine ("\nReflection.MemberInfo");
 
    //Get the Type and MemberInfo  
    Type MyType =Type.GetType("System.IO.BufferedStream"); 
    MemberInfo[] Mymemberinfoarray = MyType.GetMembers(); 
 
    //Get and display the DeclaringType method 
    Console.Write("\nThere are {0} members in ", Mymemberinfoarray.Length); 
    Console.Write("{0}.", MyType.FullName); 
 
    foreach (MemberInfo Mymemberinfo in Mymemberinfoarray) { 
      Console.Write("\n" + Mymemberinfo.Name + " reflected type - " +
         Mymemberinfo.ReflectedType);
    }
   }
 }

    
This code produces the following output:

Reflection.MemberInfo

There are 31 members in System.IO.BufferedStream.

WriteByte reflected type - System.IO.BufferedStream

Return to top


Method: AddEventHandler(
   object target,
   Delegate handler
)
Summary
Adds an event handler to an event source.
C# Syntax:
public void AddEventHandler(
   object target,
   Delegate handler
);
Parameters:

target

The event source.

handler

Encapsulates a method or methods to be invoked when the event is raised by the target.

Exceptions
Exception Type Condition
TargetInvocationException The Add method throws an exception.
ArgumentException The handler that was passed in cannot be used.
TargetException The target parameter is null and the event is not static.

-or-

The EventInfo is not declared on the target.

Remarks
This method attempts to add a delegate to synchronize the event on the target object. Each time the event is raised by the target parameter, the method or methods encapsulated by the handler will be invoked.
See also:
Object | Delegate | EventHandler

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~EventInfo();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: GetAddMethod()
Summary
Returns the method used to add an event handler delegate to the event source.
C# Syntax:
public MethodInfo GetAddMethod();
Return Value:
A MethodInfo object representing the method used to add an event handler delegate to the event source.
Remarks
GetAddMethod initializes and adds the event subscribe method. The Add method is used to add an event-handler delegate to the invocation list of an event source.
Example
Typically, the method has the following signature:

add_<EventName>(<EventHandlerType> handler)

See also:
MethodInfo

Return to top


Overloaded Method: GetAddMethod(
   bool nonPublic
)
Summary
When overridden in a derived class, retrieves the MethodInfo object for the Add method of the event, specifying whether the method is public or nonpublic.
C# Syntax:
public abstract MethodInfo GetAddMethod(
   bool nonPublic
);
Parameters:

nonPublic

true if the method is not public; otherwise, false.

Return Value:
A MethodInfo object representing the method used to add an event handler delegate to the event source.
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
Remarks
The GetAddMethod initializes and adds the event subscribe method as a Boolean value. The Add method is used to add an event-handler delegate to the invocation list of an event source.
Example
Typically, the method has the following signature:

add_<EventName>(<EventHandlerType> handler)

.NET Framework Security:
ReflectionPermission for returning methods that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation
See also:
MethodInfo

Return to top


Overloaded Method: GetCustomAttributes(
   bool inherit
)
Inherited
See base class member description: System.Reflection.MemberInfo.GetCustomAttributes

Summary
When overridden in a derived class, returns an array of all of the custom attributes.
C# Syntax:
public abstract object[] GetCustomAttributes(
   bool inherit
);
Parameters:

inherit

Specifies whether to search this member's inheritance chain to find the attributes.

Return Value:
An array of all the custom attributes, or an array with zero elements if no attributes are defined.
Implements:
ICustomAttributeProvider.GetCustomAttributes
Example

using System;
using System.Reflection;

// Define a custom attribute with one named parameter.
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute : Attribute
{
   private string myName;
   public MyAttribute(string name)
   {
      myName = name;
   }
   public string Name
   {
      get
      {
         return myName;
      }
   }
}

// Define a class which has the custom attribute associated with one of its members.
public class MyClass1
{
   [MyAttribute("This is an example attribute")]
   public void MyMethod(int i)
   {
      return;
   }
}

public class MemberInfo_GetCustomAttributes
{
   public static void Main()
   {
      try
      {
         // Get the type of the class 'MyClass1'.
         Type myType = typeof(MyClass1);
         // Get the members associated with the class 'MyClass1'.
         MemberInfo[] myMembers = myType.GetMembers();

         // Display the attributes for each of the members of the class 'MyClass1'.
         for(int i = 0; i < myMembers.Length; i++)
         {
            Object[] myAttributes = myMembers[i].GetCustomAttributes(false);
            if(myAttributes.Length > 0)
            {
               Console.WriteLine("\nThe attributes for the member {0} are : \n", myMembers[i]);
               for(int j = 0; j < myAttributes.Length; j++)
                  Console.WriteLine("The type of the attribute is : {0}", myAttributes[j]);
            }
         }
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception Caught! "+e.Message);
      }
   }
}

    
See also:
Object | CustomAttributeBuilder

Return to top


Overloaded Method: GetCustomAttributes(
   Type attributeType,
   bool inherit
)
Inherited
See base class member description: System.Reflection.MemberInfo.GetCustomAttributes

Summary
When overridden in a derived class, returns an array of custom attributes identified by Type.
C# Syntax:
public abstract object[] GetCustomAttributes(
   Type attributeType,
   bool inherit
);
Parameters:

attributeType

The type of attribute to search for. Only attributes that are assignable to this type are returned.

inherit

Specifies whether to search this member's inheritance chain to find the attributes.

Return Value:
An array of custom attributes defined on this reflected member, or an array with zero (0) elements if no attributes are defined.
Exceptions
Exception Type Condition
TypeLoadException If the custom attribute type can not be loaded.
Implements:
ICustomAttributeProvider.GetCustomAttributes

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: GetRaiseMethod()
Summary
Returns the method that is called when the event is raised.
C# Syntax:
public MethodInfo GetRaiseMethod();
Return Value:
A MethodInfo object that you call to unsubscribe to an event.
See also:
MethodInfo

Return to top


Overloaded Method: GetRaiseMethod(
   bool nonPublic
)
Summary
When overridden in a derived class, returns the method that is called when the event is raised, specifying whether the method is public or nonpublic.
C# Syntax:
public abstract MethodInfo GetRaiseMethod(
   bool nonPublic
);
Parameters:

nonPublic

true if the method is not public; otherwise, false.

Return Value:
A MethodInfo object that was called when the event was raised.
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
.NET Framework Security:
ReflectionPermission for returning methods that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation
See also:
MethodInfo

Return to top


Overloaded Method: GetRemoveMethod()
Summary
Returns the method used to remove an event handler delegate from the event source.
C# Syntax:
public MethodInfo GetRemoveMethod();
Return Value:
A MethodInfo object representing the method used to remove an event handler delegate from the event source.
Example
Typically, the method has the following signature:

remove_<EventName>(<EventHandlerType> handler)

See also:
MethodInfo

Return to top


Overloaded Method: GetRemoveMethod(
   bool nonPublic
)
Summary
When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event, specifying whether the method is public or nonpublic.
C# Syntax:
public abstract MethodInfo GetRemoveMethod(
   bool nonPublic
);
Parameters:

nonPublic

true if the method is not public; otherwise, false.

Return Value:
A MethodInfo object representing the method used to remove an event handler delegate from the event source.
Exceptions
Exception Type Condition
SecurityException The caller does not have the required permission.
Example
Typically, the method has the following signature:

remove_<EventName>(<EventHandlerType> handler)

.NET Framework Security:
ReflectionPermission for returning methods that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation
See also:
MethodInfo

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: IsDefined(
   Type attributeType,
   bool inherit
)
Inherited
See base class member description: System.Reflection.MemberInfo.IsDefined

Summary
When overridden in a derived class, indicates whether one or more instance of attributeType is defined on this member.
C# Syntax:
public abstract bool IsDefined(
   Type attributeType,
   bool inherit
);
Parameters:

attributeType

The Type object to which the custom attributes are applied.

inherit

Specifies whether to search this member's inheritance chain to find the attributes.

Return Value:
true if one or more instance of attributeType is defined on this member; otherwise false.
Implements:
ICustomAttributeProvider.IsDefined
Example

using System;
using System.Reflection;

// Define a custom attribute with one named parameter.
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute : Attribute
{
   private string myName;
   public MyAttribute(string name)
   {
      myName = name;
   }
   public string Name
   {
      get
      {
         return myName;
      }
   }
}

// Define a class which has the custom attribute associated with one of its members.
public class MyClass1
{
   [MyAttribute("This is an example attribute")]
   public void MyMethod(int i)
   {
      return;
   }
}

public class MemberInfo_GetCustomAttributes_IsDefined
{
   public static void Main()
   {
      try
      {
         // Get the type of the class 'MyClass1'.
         Type myType = typeof(MyClass1);
         // Get the members associated with the class 'MyClass1'.
         MemberInfo[] myMembers = myType.GetMembers();

         // Display the attributes for each of the members of the class 'MyClass1'.
         for(int i = 0; i < myMembers.Length; i++)
         {
            // Display the attribute if it is of type 'MyAttribute'.
            if(myMembers[i].IsDefined(typeof(MyAttribute), false))
            {
               Object[] myAttributes = myMembers[i].GetCustomAttributes(typeof(MyAttribute), false);
               Console.WriteLine("\nThe attributes of type 'MyAttribute' for the member {0} are : \n",
                                    myMembers[i]);
               for(int j = 0; j < myAttributes.Length; j++)
                  // Display the value associated with the attribute.
                  Console.WriteLine("The value of the attribute is : \"{0}\"",
                                       ((MyAttribute)myAttributes[j]).Name);
            }
         }
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception Caught! "+e.Message);
      }
   }
}

    

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: RemoveEventHandler(
   object target,
   Delegate handler
)
Summary
Removes an event handler from an event source.
C# Syntax:
public void RemoveEventHandler(
   object target,
   Delegate handler
);
Parameters:

target

The event source.

handler

Encapsulates one or more methods to be invoked when the event is raised by the target.

Exceptions
Exception Type Condition
TargetInvocationException The Remove method throws an exception.
ArgumentException The handler that was passed in cannot be used.
TargetException The target parameter is null and the event is not static.

-or-

The EventInfo is not declared on the target.

Remarks
This method attempts to remove the delegate that may synchronize this event on the target object.

When an event is raised by target, the method or methods encapsulated by handler will no longer be invoked.

See also:
Object | Delegate | EventHandler

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.