PropertyBuilder.IsDefined 方法

指示是否在此属性 (Property) 上定义一个或多个 attributeType 的实例。

**命名空间:**System.Reflection.Emit
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Overrides Function IsDefined ( _
    attributeType As Type, _
    inherit As Boolean _
) As Boolean
用法
Dim instance As PropertyBuilder
Dim attributeType As Type
Dim inherit As Boolean
Dim returnValue As Boolean

returnValue = instance.IsDefined(attributeType, inherit)
public override bool IsDefined (
    Type attributeType,
    bool inherit
)
public:
virtual bool IsDefined (
    Type^ attributeType, 
    bool inherit
) override
public boolean IsDefined (
    Type attributeType, 
    boolean inherit
)
public override function IsDefined (
    attributeType : Type, 
    inherit : boolean
) : boolean

参数

  • attributeType
    自定义属性 (Attribute) 应用于的 Type 对象。
  • inherit
    指定是否遍历属性的继承链以查找自定义属性 (Attribute)。

返回值

如果在此属性 (Property) 上定义一个或多个 attributeType 实例,则为 true;否则为 false

异常

异常类型 条件

NotSupportedException

不支持此方法。

备注

使用 Type.GetType 或 Assembly.GetType 获取属性 (Property) 的父类型,从该类型检索 Reflection 属性 (Property) 对象并调用 PropertyInfo.IsDefined。

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

PropertyBuilder 类
PropertyBuilder 成员
System.Reflection.Emit 命名空间