DynamicMethod.ReturnType 属性

定义

获取动态方法的返回值的类型。

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

适用于