EnumBuilder.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

将应用自定义属性的 Type 对象。

inherit
Boolean

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

返回

Boolean

如果在此成员上定义了一个或多个 attributeType 的实例,则为 true;否则为 false

例外

不完整类型目前不支持此方法。

注解

解决方法是,若要检查是否为已完成类型定义了自定义属性,请检索返回GetTypeType的类型并调用GetCustomAttributes

适用于