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

控制自訂屬性來自基底類別的繼承。

傳回

如果 attributeType 的一個或多個執行個體在這個欄位上定義,則為 true,否則為 false

例外狀況

目前不支援這個方法。 使用 GetField(String, BindingFlags) 擷取欄位,並在傳回 IsDefined(Type, Boolean) 上呼叫 FieldInfo

適用於