ConstructorBuilder.IsDefined 方法

检查是否定义了指定的自定义属性类型。

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

语法

声明
Public Overrides Function IsDefined ( _
    attributeType As Type, _
    inherit As Boolean _
) As Boolean
用法
Dim instance As ConstructorBuilder
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
    自定义属性类型。
  • inherit
    控制来自基类的自定义属性的继承性。忽略此参数。

返回值

如果定义了指定的自定义属性类型,则为 true;否则为 false

异常

异常类型 条件

NotSupportedException

目前不支持此方法。可以使用 GetConstructor 检索构造函数,并对返回的 ConstructorInfo 调用 IsDefined

备注

有关如何格式化 binaryAttribute 的详细信息,请参见元数据规范。

平台

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

请参见

参考

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