DynamicMethod.ReflectedType 属性

定义

获取在反射中用于获取该方法的类。Gets the class that was used in reflection to obtain the method.

public:
 virtual property Type ^ ReflectedType { Type ^ get(); };
public override Type? ReflectedType { get; }
public override Type ReflectedType { get; }
member this.ReflectedType : Type
Public Overrides ReadOnly Property ReflectedType As Type

属性值

Type

总是为 nullAlways null.

示例

下面的代码示例显示动态方法的反射类型。The following code example displays the reflected type of a dynamic method. 此代码示例是为类提供的更大示例的一部分 DynamicMethodThis code example is part of a larger example provided for the DynamicMethod class.

// For dynamic methods, the reflected type is always null.
if (hello->ReflectedType == nullptr)
{
    Console::WriteLine("\r\nReflectedType is null.");
}
else
{
    Console::WriteLine("\r\nReflectedType: {0}", hello->ReflectedType);
}
// For dynamic methods, the reflected type is always null.
if (hello.ReflectedType == null)
{
    Console.WriteLine("\r\nReflectedType is null.");
}
else
{
    Console.WriteLine("\r\nReflectedType: {0}", hello.ReflectedType);
}
' For dynamic methods, the reflected type is always Nothing.
If hello.ReflectedType Is Nothing Then
    Console.WriteLine(vbCrLf & "ReflectedType is Nothing.")
Else
    Console.WriteLine(vbCrLf & "ReflectedType: {0}", _
        hello.ReflectedType)
End If

注解

此属性始终 null 为动态方法返回。This property always returns null for dynamic methods.

适用于