閱讀英文版本

分享方式:


ICustomAttributeProvider 介面

定義

提供自訂屬性以反映支援它們的物件。

C#
public interface ICustomAttributeProvider
C#
[System.Runtime.InteropServices.ComVisible(true)]
public interface ICustomAttributeProvider
衍生
屬性

備註

幾乎所有 Reflection 類別都可以有相關聯的屬性。 屬性可以是標準 (公用、私用、HelpString) 或自定義。

方法

GetCustomAttributes(Boolean)

傳回這個成員中定義的所有自訂屬性的陣列 (但具名屬性除外),如果沒有自訂屬性,則傳回空陣列。

GetCustomAttributes(Type, Boolean)

傳回這個成員中定義的自訂屬性陣列 (依類型識別),如果沒有該類型的自訂屬性,則傳回空陣列。

IsDefined(Type, Boolean)

指出此成員上是否有定義一個或多個 attributeType 執行個體。

適用於

產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.5, 1.6, 2.0, 2.1