TypeBuilder.IsDefined(Type, Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定自定义属性是否应用于当前类型。
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 未定义。
attributeType 是 null。
注解
对于不完整的泛型类型参数,不支持此方法。 使用 Type.GetType 或使用 Assembly.GetType 所检索类型的反射来检索类型。