ComAwareEventInfo.GetCustomAttributes 方法

定義

在衍生類別中遭覆寫時,傳回套用至這個成員的所有屬性。When overridden in a derived class, returns all attributes that are applied to this member.

多載

GetCustomAttributes(Boolean)

在衍生類別中遭覆寫時,取得包含所有套用至此成員之自訂屬性的陣列。When overridden in a derived class, gets an array that contains all the custom attributes that are applied to this member.

GetCustomAttributes(Type, Boolean)

在衍生類別中遭覆寫時,取得包含所有套用至此成員之指定型別自訂屬性的陣列。When overridden in a derived class, gets an array that contains all the custom attributes of the specified type that are applied to this member.

GetCustomAttributes(Boolean)

在衍生類別中遭覆寫時,取得包含所有套用至此成員之自訂屬性的陣列。When overridden in a derived class, gets an array that contains all the custom attributes that are applied to this member.

public:
 override cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public override object[] GetCustomAttributes (bool inherit);
override this.GetCustomAttributes : bool -> obj[]
Public Overrides Function GetCustomAttributes (inherit As Boolean) As Object()

參數

inherit
Boolean

true 表示要搜尋這個成員的繼承鏈結以尋找屬性;否則為 falsetrue to search this member's inheritance chain to find the attributes; otherwise, false.

傳回

Object[]

包含所有自訂屬性的陣列,如果沒有定義屬性,則為不包含任何元素的陣列。An array that contains all the custom attributes, or an array that has no elements if no attributes were defined.

例外狀況

這個成員所屬的型別已載入僅限反映的內容中。This member belongs to a type that is loaded into the reflection-only context. 請參閱如何:將組件載入僅限反映的內容See How to: Load Assemblies into the Reflection-Only Context.

無法載入自訂屬性型別。A custom attribute type cannot be loaded.

備註

這個方法會呼叫 GetCustomAttributes 基礎物件的方法 EventInfoThis method calls the GetCustomAttributes method of the underlying EventInfo object.

另請參閱

適用於

GetCustomAttributes(Type, Boolean)

在衍生類別中遭覆寫時,取得包含所有套用至此成員之指定型別自訂屬性的陣列。When overridden in a derived class, gets an array that contains all the custom attributes of the specified type that are applied to this member.

public:
 override cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public override object[] GetCustomAttributes (Type attributeType, bool inherit);
override this.GetCustomAttributes : Type * bool -> obj[]
Public Overrides Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()

參數

attributeType
Type

要搜尋的屬性型別。The attribute type to search for. 只傳回可以指派給這個型別的屬性。Only attributes that are assignable to this type can be returned.

inherit
Boolean

true 表示要搜尋這個成員的繼承鏈結以尋找屬性;否則為 falsetrue to search this member's inheritance chain to find the attributes; otherwise, false.

傳回

Object[]

包含指定型別所有的自訂屬性之陣列,如果沒有定義屬性,則為不包含任何元素的陣列。An array that contains all the custom attributes of the specified type, or an array that has no elements if no attributes were defined.

例外狀況

attributeTypenullattributeType is null.

這個成員所屬的型別已載入僅限反映的內容中。This member belongs to a type that is loaded into the reflection-only context. 請參閱如何:將組件載入僅限反映的內容See How to: Load Assemblies into the Reflection-Only Context

無法載入自訂屬性型別。A custom attribute type cannot be loaded.

另請參閱

適用於