CustomAttributeExtensions.IsDefined 方法

定義

顯示是否套用自訂屬性於元素。

多載

名稱 Description
IsDefined(MemberInfo, Type, Boolean)

表示是否將特定類型的自訂屬性套用於指定成員,並可選擇套用於其祖先。

IsDefined(Assembly, Type)

指出指定的型別的自定義屬性是否套用至指定的元件。

IsDefined(MemberInfo, Type)

表示是否套用特定類型的自訂屬性給指定成員。

IsDefined(Module, Type)

表示是否套用特定類型的自訂屬性於特定模組。

IsDefined(ParameterInfo, Type)

指示是否套用特定類型的自訂屬性於特定參數。

IsDefined(ParameterInfo, Type, Boolean)

表示是否將特定類型的自訂屬性套用到指定參數,並可選擇套用到其前身。

IsDefined(MemberInfo, Type, Boolean)

表示是否將特定類型的自訂屬性套用於指定成員,並可選擇套用於其祖先。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::MemberInfo ^ element, Type ^ attributeType, bool inherit);
public static bool IsDefined(this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
static member IsDefined : System.Reflection.MemberInfo * Type * bool -> bool
<Extension()>
Public Function IsDefined (element As MemberInfo, attributeType As Type, inherit As Boolean) As Boolean

參數

element
MemberInfo

要檢查的成員。

attributeType
Type

要搜尋屬性的類型。

inherit
Boolean

true以檢視祖element先;否則,。 false

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

element 不是建構子、方法、屬性、事件、類型或欄位。

適用於

IsDefined(Assembly, Type)

指出指定的型別的自定義屬性是否套用至指定的元件。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::Assembly ^ element, Type ^ attributeType);
public static bool IsDefined(this System.Reflection.Assembly element, Type attributeType);
static member IsDefined : System.Reflection.Assembly * Type -> bool
<Extension()>
Public Function IsDefined (element As Assembly, attributeType As Type) As Boolean

參數

element
Assembly

要檢查的組裝。

attributeType
Type

要搜尋屬性的類型。

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

適用於

IsDefined(MemberInfo, Type)

表示是否套用特定類型的自訂屬性給指定成員。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::MemberInfo ^ element, Type ^ attributeType);
public static bool IsDefined(this System.Reflection.MemberInfo element, Type attributeType);
static member IsDefined : System.Reflection.MemberInfo * Type -> bool
<Extension()>
Public Function IsDefined (element As MemberInfo, attributeType As Type) As Boolean

參數

element
MemberInfo

要檢查的成員。

attributeType
Type

要搜尋的屬性類型。

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

element 不是建構子、方法、屬性、事件、類型或欄位。

適用於

IsDefined(Module, Type)

表示是否套用特定類型的自訂屬性於特定模組。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::Module ^ element, Type ^ attributeType);
public static bool IsDefined(this System.Reflection.Module element, Type attributeType);
static member IsDefined : System.Reflection.Module * Type -> bool
<Extension()>
Public Function IsDefined (element As Module, attributeType As Type) As Boolean

參數

element
Module

要檢查的模組。

attributeType
Type

要搜尋的屬性類型。

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

適用於

IsDefined(ParameterInfo, Type)

指示是否套用特定類型的自訂屬性於特定參數。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::ParameterInfo ^ element, Type ^ attributeType);
public static bool IsDefined(this System.Reflection.ParameterInfo element, Type attributeType);
static member IsDefined : System.Reflection.ParameterInfo * Type -> bool
<Extension()>
Public Function IsDefined (element As ParameterInfo, attributeType As Type) As Boolean

參數

element
ParameterInfo

要檢查的參數。

attributeType
Type

要搜尋的屬性類型。

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

適用於

IsDefined(ParameterInfo, Type, Boolean)

表示是否將特定類型的自訂屬性套用到指定參數,並可選擇套用到其前身。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::ParameterInfo ^ element, Type ^ attributeType, bool inherit);
public static bool IsDefined(this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
static member IsDefined : System.Reflection.ParameterInfo * Type * bool -> bool
<Extension()>
Public Function IsDefined (element As ParameterInfo, attributeType As Type, inherit As Boolean) As Boolean

參數

element
ParameterInfo

要檢查的參數。

attributeType
Type

要搜尋的屬性類型。

inherit
Boolean

true以檢視祖element先;否則,。 false

傳回

true若對特定類型的屬性套用element;否則,。 false

例外狀況

elementattributeTypenull

attributeType 並非由 推導而來 Attribute

適用於