DescriptionAttribute クラス
アセンブリ: System (system.dll 内)

<AttributeUsageAttribute(AttributeTargets.All)> _ Public Class DescriptionAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets::All)] public ref class DescriptionAttribute : public Attribute

ビジュアル デザイナでは、コンポーネント メンバを参照する場合に、指定した説明を [プロパティ] ウィンドウなどに表示できます。この属性の値にアクセスするには、Description を呼び出します。
詳細については、属性の概要、属性を使用したメタデータの拡張 の各トピックを参照してください。

MyImage プロパティを作成する例を次に示します。このプロパティには、DescriptionAttribute と CategoryAttribute の 2 つの属性があります。
<Description("The image associated with the control"), _ Category("Appearance")> _ Public Property MyImage() As Image Get ' Insert code here. Return image1 End Get Set ' Insert code here. End Set End Property
[Description("The image associated with the control"),Category("Appearance")] public Image MyImage { get { // Insert code here. return image1; } set { // Insert code here. } }
public: property Image^ MyImage { [Description("The image associated with the control"),Category("Appearance")] Image^ get() { // Insert code here. return image1; } void set( Image^ value ) { // Insert code here. } }
/** @attribute Description("The image associated with the control") @attribute Category("Appearance") */ /** @property */ public Image get_MyImage() { // Insert code here. return image1; } //get_MyImage /** @property */ public void set_MyImage(Image value) { // Insert code here. } //set_MyImage
MyImage の説明を取得する例を次に示します。最初に、オブジェクトのすべてのプロパティを保持する PropertyDescriptorCollection を取得します。次に、インデックスを付けて PropertyDescriptorCollection から MyImage を取得します。そして、このプロパティの属性を返し、その属性を属性変数に保存します。
最後に、AttributeCollection から DescriptionAttribute を取得し、取得した情報をコンソール画面に書き込むことによって、説明を出力します。
' Gets the attributes for the property. Dim attributes As AttributeCollection = _ TypeDescriptor.GetProperties(Me)("MyImage").Attributes ' Prints the description by retrieving the DescriptionAttribute ' from the AttributeCollection. Dim myAttribute As DescriptionAttribute = _ CType(attributes(GetType(DescriptionAttribute)), DescriptionAttribute) Console.WriteLine(myAttribute.Description)
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this)["MyImage"].Attributes; /* Prints the description by retrieving the DescriptionAttribute * from the AttributeCollection. */ DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)]; Console.WriteLine(myAttribute.Description);
// Gets the attributes for the property. AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes; /* Prints the description by retrieving the DescriptionAttribute * from the AttributeCollection. */ DescriptionAttribute^ myAttribute = dynamic_cast<DescriptionAttribute^>(attributes[ DescriptionAttribute::typeid ]); Console::WriteLine( myAttribute->Description );
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this). get_Item("MyImage").get_Attributes(); /* Prints the description by retrieving the DescriptionAttribute from the AttributeCollection. */ DescriptionAttribute myAttribute = (DescriptionAttribute)(attributes. get_Item(DescriptionAttribute.class.ToType())); Console.WriteLine(myAttribute.get_Description());



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DescriptionAttribute クラス
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)

<ComVisibleAttribute(False)> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Interface, Inherited:=True)> _ Public NotInheritable Class DescriptionAttribute Inherits Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Interface, Inherited=true)] public sealed class DescriptionAttribute : Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Method|AttributeTargets::Interface, Inherited=true)] public ref class DescriptionAttribute sealed : public Attribute


この属性の使用方法については、次のコード例を参照してください。
<Assembly: Description("A system for ensuring that the correct account balance is stored after a transaction.")>
[assembly: Description("A system for ensuring that the correct account balance is stored after a transaction.")]

System.Attribute
System.EnterpriseServices.DescriptionAttribute


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DescriptionAttribute コンストラクタ ()
アセンブリ: System (system.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DescriptionAttribute コンストラクタ (String)
アセンブリ: System (system.dll 内)

Public Sub New ( _ description As String _ )
Dim description As String Dim instance As New DescriptionAttribute(description)
public DescriptionAttribute ( string description )
public: DescriptionAttribute ( String^ description )
public DescriptionAttribute ( String description )
public function DescriptionAttribute ( description : String )

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DescriptionAttribute コンストラクタ

名前 | 説明 |
---|---|
DescriptionAttribute () | パラメータを指定せずに、DescriptionAttribute クラスの新しいインスタンスを初期化します。 |
DescriptionAttribute (String) | 説明を指定して、DescriptionAttribute クラスの新しいインスタンスを初期化します。 |

DescriptionAttribute コンストラクタ
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)


このコンストラクタの使用方法については、次のコード例を参照してください。
<Assembly: Description("A system for ensuring that the correct account balance is stored after a transaction.")>
[assembly: Description("A system for ensuring that the correct account balance is stored after a transaction.")]


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DescriptionAttribute フィールド


関連項目
DescriptionAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
EventDescriptor
DescriptionAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | Description | この属性に格納されている説明を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |


関連項目
DescriptionAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
EventDescriptor
DescriptionAttribute プロパティ
DescriptionAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の DescriptionAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 これが既定の DescriptionAttribute インスタンスであるかどうかを示す値を返します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
DescriptionAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
EventDescriptor
DescriptionAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

DescriptionAttribute メンバ
DescriptionAttribute データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Description | この属性に格納されている説明を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の DescriptionAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 これが既定の DescriptionAttribute インスタンスであるかどうかを示す値を返します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
DescriptionAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
EventDescriptor
DescriptionAttribute メンバ
アセンブリ (アプリケーション)、コンポーネント、メソッド、またはインターフェイスに説明を設定します。このクラスは継承できません。
DescriptionAttribute データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- DescriptionAttributeのページへのリンク