TypeBuilder.IsDefined(Type, Boolean) 方法

定义

确定自定义属性是否应用于当前类型。

public:
 override bool IsDefined(Type ^ attributeType, bool inherit);
public override bool IsDefined(Type attributeType, bool inherit);
override this.IsDefined : Type * bool -> bool
Public Overrides Function IsDefined (attributeType As Type, inherit As Boolean) As Boolean

参数

attributeType
Type

要搜索的属性的类型。 仅返回可分配给此类型的属性。

inherit
Boolean

指定是否搜索此成员的继承链以查找属性。

返回

true 如果在此类型上定义了一个或多个 attributeType实例或派生 attributeType自的属性,则为 否则为 false

例外

对于不完整的类型,目前不支持此方法。 检索返回GetType()IsDefined(Type, Boolean)的类型并调用 Type

attributeType 未定义。

attributeTypenull

注解

对于不完整的泛型类型参数,不支持此方法。 使用 Type.GetType 或使用 Assembly.GetType 所检索类型的反射来检索类型。

适用于