TypeBuilder.GetCustomAttributes 方法

定義

傳回為這個類型定義的自訂屬性。

多載

GetCustomAttributes(Boolean)

傳回為這個類型定義的所有自訂屬性。

GetCustomAttributes(Type, Boolean)

傳回可指派給指定類型之目前類型的所有自訂屬性。

GetCustomAttributes(Boolean)

來源:
TypeBuilder.cs

傳回為這個類型定義的所有自訂屬性。

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

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

傳回

Object[]

傳回代表這個類型的所有自訂屬性的物件陣列。

例外狀況

這個方法目前不支援不完整的類型。 使用 GetType() 擷取類型,並在傳回的 Type 上呼叫 GetCustomAttributes(Boolean)

適用於

GetCustomAttributes(Type, Boolean)

來源:
TypeBuilder.cs

傳回可指派給指定類型之目前類型的所有自訂屬性。

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

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

傳回

Object[]

在目前類型上定義的自訂屬性陣列。

例外狀況

這個方法目前不支援不完整的類型。 使用 GetType() 擷取類型,並在傳回的 Type 上呼叫 GetCustomAttributes(Boolean)

attributeTypenull

類型必須是基礎執行階段系統所提供的類型。

適用於