EventInfo.GetRaiseMethod Method

Definition

Returns the method that is called when the event is raised.

Overloads

GetRaiseMethod()

Returns the method that is called when the event is raised.

GetRaiseMethod(Boolean)

When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods.

GetRaiseMethod()

Source:
EventInfo.cs
Source:
EventInfo.cs
Source:
EventInfo.cs

Returns the method that is called when the event is raised.

C#
public System.Reflection.MethodInfo? GetRaiseMethod();
C#
public System.Reflection.MethodInfo GetRaiseMethod();

Returns

The method that is called when the event is raised.

Implements

Remarks

This method usually returns null for events declared with the C# event keyword or the Visual Basic Event keyword. This is because the C# and Visual Basic compilers do not generate such a method by default.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.5, 1.6, 2.0, 2.1

GetRaiseMethod(Boolean)

Source:
EventInfo.cs
Source:
EventInfo.cs
Source:
EventInfo.cs

When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods.

C#
public abstract System.Reflection.MethodInfo? GetRaiseMethod(bool nonPublic);
C#
public abstract System.Reflection.MethodInfo GetRaiseMethod(bool nonPublic);

Parameters

nonPublic
Boolean

true if non-public methods can be returned; otherwise, false.

Returns

A MethodInfo object that was called when the event was raised.

Implements

Exceptions

nonPublic is true, the method used to add an event handler delegate is non-public, and the caller does not have permission to reflect on non-public methods.

Remarks

This method usually returns null for events declared with the C# event keyword or the Visual Basic Event keyword. This is because the C# and Visual Basic compilers do not generate such a method by default.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.5, 1.6, 2.0, 2.1