DynamicMethod.DeclaringType 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取声明方法的类型,对于动态方法,此类型始终为 null。
public:
 virtual property Type ^ DeclaringType { Type ^ get(); };
	public override Type? DeclaringType { get; }
	public override Type DeclaringType { get; }
	member this.DeclaringType : Type
	Public Overrides ReadOnly Property DeclaringType As Type
	属性值
总是为 null。
示例
下面的代码示例显示动态方法的声明类型。 此代码示例是为 DynamicMethod 类提供的一个更大示例的一部分。
// Display the declaring type, which is always null for dynamic
// methods.
if (hello.DeclaringType == null)
{
    Console.WriteLine("\r\nDeclaringType is always null for dynamic methods.");
}
else
{
    Console.WriteLine("DeclaringType: {0}", hello.DeclaringType);
}
' Display the declaring type, which is always Nothing for dynamic
' methods.
If hello.DeclaringType Is Nothing Then
    Console.WriteLine(vbCrLf & "DeclaringType is always Nothing for dynamic methods.")
Else
    Console.WriteLine("DeclaringType: {0}", hello.DeclaringType)
End If
	注解
对于动态方法, null 此属性始终返回 。 即使动态方法在逻辑上与类型相关联,该类型也不会声明它。