DynamicMethod.GetCustomAttributes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳套用到方法上的自訂屬性。
多載
| 名稱 | Description |
|---|---|
| GetCustomAttributes(Boolean) |
會回傳所有為該方法定義的自訂屬性。 |
| GetCustomAttributes(Type, Boolean) |
回傳已套用到方法的指定類型自訂屬性。 |
GetCustomAttributes(Boolean)
會回傳所有為該方法定義的自訂屬性。
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 搜尋方法的繼承鏈以尋找自訂屬性; false 只檢查目前的方法。
傳回
一個代表方法所有自訂屬性的物件陣列。
備註
對於動態方法,指定 true 也 inherit 沒有影響,因為該方法並未以型別宣告。
Note
動態方法目前不支援自訂屬性。 唯一回傳的屬性是 MethodImplAttribute;你可以更輕鬆地使用該 GetMethodImplementationFlags 方法取得方法實作的旗標。
另請參閱
適用於
GetCustomAttributes(Type, Boolean)
回傳已套用到方法的指定類型自訂屬性。
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()
參數
- inherit
- Boolean
true 搜尋方法的繼承鏈以尋找自訂屬性; false 只檢查目前的方法。
傳回
一組代表方法屬性的物件陣列,這些物件的型別 attributeType 為 或源自型別 attributeType。
例外狀況
attributeType 是 null。
備註
對於動態方法,指定 true 也 inherit 沒有影響,因為該方法並未以型別宣告。
Note
動態方法目前不支援自訂屬性。 唯一回傳的屬性是 MethodImplAttribute;你可以更輕鬆地使用該 GetMethodImplementationFlags 方法取得方法實作的旗標。