_MemberInfo.GetCustomAttributes 方法

定義

為 COM 物件提供與版本無關的 GetCustomAttributes 方法之存取權。

多載

GetCustomAttributes(Boolean)

為 COM 物件提供與版本無關的 GetCustomAttributes(Boolean) 方法之存取權。

GetCustomAttributes(Type, Boolean)

為 COM 物件提供與版本無關的 GetCustomAttributes(Type, Boolean) 方法之存取權。

備註

這個方法適用於從 Unmanaged 程式代碼存取 Managed 類別,不應從 Managed 程式代碼呼叫。

方法 MemberInfo.GetCustomAttributes 會傳回套用至這個成員的所有屬性。

GetCustomAttributes(Boolean)

為 COM 物件提供與版本無關的 GetCustomAttributes(Boolean) 方法之存取權。

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

參數

inherit
Boolean

true 表示要搜尋這個成員的繼承鏈結以尋找屬性;否則為 false

傳回

Object[]

包含所有自訂屬性的陣列,如果沒有定義屬性,則為包含零 (0) 元素的陣列。

備註

這個方法適用於從 Unmanaged 程式代碼存取 Managed 類別,不應從 Managed 程式代碼呼叫。

方法 MemberInfo.GetCustomAttributes 會傳回包含所有自定義屬性的陣列。

適用於

GetCustomAttributes(Type, Boolean)

為 COM 物件提供與版本無關的 GetCustomAttributes(Type, Boolean) 方法之存取權。

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

參數

attributeType
Type

要搜尋的屬性類型。 只會傳回可指派給這種類型的屬性。

inherit
Boolean

true 表示要搜尋這個成員的繼承鏈結以尋找屬性;否則為 false

傳回

Object[]

套用至這個成員的自訂屬性陣列,如果沒有套用屬性,則為包含零 (0) 元素的陣列。

備註

這個方法適用於從 Unmanaged 程式代碼存取 Managed 類別,不應從 Managed 程式代碼呼叫。

方法 Assembly.GetCustomAttributes 會傳回 所 Type識別之自定義屬性的陣列。

適用於