EventInfo.GetRaiseMethod 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回引發事件時所呼叫的方法。
GetRaiseMethod() |
傳回引發事件時所呼叫的方法。 |
GetRaiseMethod(Boolean) |
在衍生類別中覆寫時,傳回在引發事件時所呼叫的方法,指定是否要傳回非公用方法。 |
- 來源:
- EventInfo.cs
- 來源:
- EventInfo.cs
- 來源:
- EventInfo.cs
傳回引發事件時所呼叫的方法。
public:
System::Reflection::MethodInfo ^ GetRaiseMethod();
public:
virtual System::Reflection::MethodInfo ^ GetRaiseMethod();
C#
public System.Reflection.MethodInfo? GetRaiseMethod();
C#
public System.Reflection.MethodInfo GetRaiseMethod();
member this.GetRaiseMethod : unit -> System.Reflection.MethodInfo
abstract member GetRaiseMethod : unit -> System.Reflection.MethodInfo
override this.GetRaiseMethod : unit -> System.Reflection.MethodInfo
Public Function GetRaiseMethod () As MethodInfo
傳回
引發事件時所呼叫的方法。
實作
備註
這個方法通常會針對使用 C# event
關鍵字或 Visual Basic Event
關鍵詞宣告的事件傳回 null
。 這是因為 C# 和 Visual Basic 編譯程式預設不會產生這類方法。
另請參閱
適用於
.NET 10 和其他版本
產品 | 版本 |
---|---|
.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, 10 |
.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 |
- 來源:
- EventInfo.cs
- 來源:
- EventInfo.cs
- 來源:
- EventInfo.cs
在衍生類別中覆寫時,傳回在引發事件時所呼叫的方法,指定是否要傳回非公用方法。
public:
abstract System::Reflection::MethodInfo ^ GetRaiseMethod(bool nonPublic);
C#
public abstract System.Reflection.MethodInfo? GetRaiseMethod(bool nonPublic);
C#
public abstract System.Reflection.MethodInfo GetRaiseMethod(bool nonPublic);
abstract member GetRaiseMethod : bool -> System.Reflection.MethodInfo
Public MustOverride Function GetRaiseMethod (nonPublic As Boolean) As MethodInfo
參數
- nonPublic
- Boolean
如果可以傳回非公用方法,則為 true
;否則為 false
。
傳回
在引發事件時呼叫的 MethodInfo
物件。
實作
例外狀況
nonPublic
是 true
、用來新增事件處理常式委派的方法為非公用的,而且呼叫端無權反映於非公用方法上。
備註
這個方法通常會針對使用 C# event
關鍵字或 Visual Basic Event
關鍵詞宣告的事件傳回 null
。 這是因為 C# 和 Visual Basic 編譯程式預設不會產生這類方法。
另請參閱
適用於
.NET 10 和其他版本
產品 | 版本 |
---|---|
.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, 10 |
.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 |