_FieldInfo.GetCustomAttributes 方法

定義

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

多載

GetCustomAttributes(Boolean)

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

GetCustomAttributes(Type, Boolean)

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

備註

此方法適用于從 Unmanaged 程式碼存取 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

指定是否要搜尋這個成員的繼承鏈結以尋找屬性。

傳回

Object[]

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

備註

此方法適用于從 Unmanaged 程式碼存取 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

指定是否要搜尋這個成員的繼承鏈結以尋找屬性。

傳回

Object[]

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

備註

此方法適用于從 Unmanaged 程式碼存取 Managed 類別,不應從 Managed 程式碼呼叫。

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

適用於