ConstructorBuilder.GetCustomAttributes 方法

定義

傳回為這個建構函式定義的自訂屬性。

多載

GetCustomAttributes(Boolean)

傳回為這個建構函式定義的所有自訂屬性。

GetCustomAttributes(Type, Boolean)

傳回指定類型所識別的自訂屬性。

GetCustomAttributes(Boolean)

來源:
ConstructorBuilder.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[]

物件陣列,代表這個 ConstructorBuilder 執行個體所代表的建構函式所有自訂屬性。

例外狀況

目前不支援這個方法。

備註

因為 inherit 類別永遠不會從基類繼承建構函式,所以會忽略 參數。

若要取得自定義屬性,請呼叫 CreateType來完成型別的建置,方法是在傳回的類型上呼叫 GetConstructor 方法,然後在傳ConstructorInfo回的 上呼叫 GetCustomAttributes 方法,以擷取建構函式。

適用於

GetCustomAttributes(Type, Boolean)

來源:
ConstructorBuilder.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[]

物件陣列,代表這個建構函式的屬性。

例外狀況

目前不支援這個方法。

備註

因為 inherit 類別永遠不會從基類繼承建構函式,所以會忽略 參數。

若要取得自定義屬性,請呼叫 CreateType來完成型別的建置,方法是在傳回的類型上呼叫 GetConstructor 方法,然後在傳ConstructorInfo回的 上呼叫 GetCustomAttributes 方法,以擷取建構函式。

適用於