DynamicMethod.ReturnType 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得此動態方法傳回值的類型。
public:
virtual property Type ^ ReturnType { Type ^ get(); };
public override Type ReturnType { get; }
member this.ReturnType : Type
Public Overrides ReadOnly Property ReturnType As Type
屬性值
Type 代表目前方法之傳回值的類型;如果此方法沒有傳回型別,則為 Void。
範例
下列程式代碼範例會顯示動態方法的傳回類型。 此程式代碼範例是針對 類別提供的較大範例的 DynamicMethod 一部分。
// If the method has no return type, ReturnType is System.Void.
Console::WriteLine("\r\nReturn type: {0}", hello->ReturnType);
// If the method has no return type, ReturnType is System.Void.
Console.WriteLine("\r\nReturn type: {0}", hello.ReturnType);
' If the method has no return type, ReturnType is System.Void.
Console.WriteLine(vbCrLf & "Return type: {0}", hello.ReturnType)
備註
如果在 null
建立動態方法時為傳回型別指定,則這個屬性會傳 System.Void回 。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應