PropertyBuilder.GetCustomAttributes 方法

定義

傳回所有在這個屬性 (Property) 上定義的自訂屬性 (Attribute)。

多載

GetCustomAttributes(Type, Boolean)

傳回由 Type 識別的自訂屬性陣列。

GetCustomAttributes(Boolean)

傳回這個屬性 (Property) 的所有自訂屬性 (Attribute) 陣列。

GetCustomAttributes(Type, Boolean)

來源:
PropertyBuilder.cs

傳回由 Type 識別的自訂屬性陣列。

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

由型別識別的自訂屬性陣列。

inherit
Boolean

如果為 true,則沿著這個屬性 (Property) 的繼承鍊結往上尋找自訂屬性 (Attribute)。

傳回

Object[]

在這個反映成員上定義的自訂屬性陣列,或 null (如果這個成員上沒有定義任何屬性)。

例外狀況

不支援這個方法。

備註

使用 Type.GetType 或 Assembly.GetType 反映屬性的父類型、從類型擷取 Reflection 屬性物件,以及呼叫 PropertyInfo.GetCustomAttributes。

適用於

GetCustomAttributes(Boolean)

來源:
PropertyBuilder.cs

傳回這個屬性 (Property) 的所有自訂屬性 (Attribute) 陣列。

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,則沿著這個屬性 (Property) 的繼承鍊結往上尋找自訂屬性 (Attribute)。

傳回

Object[]

所有自訂屬性的陣列。

例外狀況

不支援這個方法。

備註

使用 Type.GetType 或 Assembly.GetType 反映屬性的父類型、從類型擷取 Reflection 屬性物件,以及呼叫 PropertyInfo.GetCustomAttributes。

適用於