次の方法で共有


AttributeTable.GetCustomAttributes メソッド (Type)

指定した型に対して提供されるすべての属性の列挙体を返します。

名前空間:  Microsoft.Windows.Design.Metadata
アセンブリ:  Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)

構文

'宣言
Public Function GetCustomAttributes ( _
    type As Type _
) As IEnumerable
public IEnumerable GetCustomAttributes(
    Type type
)
public:
IEnumerable^ GetCustomAttributes(
    Type^ type
)
member GetCustomAttributes : 
        type:Type -> IEnumerable 
public function GetCustomAttributes(
    type : Type
) : IEnumerable

パラメーター

  • type
    型: System.Type
    クラス レベルの属性を取得する型。

戻り値

型: System.Collections.IEnumerable
属性の列挙体。

例外

例外 条件
ArgumentNullException

type は nullnull 参照 (Visual Basic では Nothing) なので、

解説

このメソッドでは、nullnull 参照 (Visual Basic では Nothing) 列挙体が返されることはありません。

GetCustomAttributes メソッドを使用して、型のカスタム属性を取得する方法を次のコード例に示します。 次のコード例は、AttributeTable クラス用のより大きなコード例の一部です。

Dim attrs0 As IEnumerable = attributes.GetCustomAttributes(GetType(Button))
IEnumerable attrs0 = attributes.GetCustomAttributes(typeof(Button));

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

AttributeTable クラス

GetCustomAttributes オーバーロード

Microsoft.Windows.Design.Metadata 名前空間

AttributeTableBuilder