Share via


_MethodBase.GetCustomAttributes 方法

定義

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

多載

GetCustomAttributes(Boolean)

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

GetCustomAttributes(Type, Boolean)

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

備註

這個方法是用來從非受控碼存取 managed 類別,不應該從 managed 程式碼呼叫。

成員會傳回套用 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) 元素的陣列。

備註

這個方法是用來從非受控碼存取 managed 類別,不應該從 managed 程式碼呼叫。

方法會傳回 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) 元素的陣列。

備註

這個方法是用來從非受控碼存取 managed 類別,不應該從 managed 程式碼呼叫。

方法會傳回 GetCustomAttributes 由所識別的自訂屬性陣列 Type

適用於