DisplayNameAttributeとは? わかりやすく解説

DisplayNameAttribute クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

引数を受け取らないプロパティ、イベント、またはパブリックな void メソッドの表示名を指定します。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method
 Or AttributeTargets.Property Or AttributeTargets.Event)>
 _
Public Class DisplayNameAttribute
    Inherits Attribute
Dim instance As DisplayNameAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event)]
 
public class DisplayNameAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Event)]
 
public ref class DisplayNameAttribute : public
 Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event)
 */ 
public class DisplayNameAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event)
 
public class DisplayNameAttribute extends
 Attribute
解説解説
使用例使用例

DisplayNameAttribute クラスを使用して、PropertyGrid コントロールで、MisnamedProperty と呼ばれるプロパティの名前を RenamedProperty に変更するコード例を次に示します。コード全体については、「方法 : Windows フォーム コントロールに属性を適用する」を参照してください。

' This property exists only to demonstrate the 
' DisplayName attribute. When this control 
' is attached to a PropertyGrid control, the
' property will be appear as "RenamedProperty"
' instead of "MisnamedProperty".
<Description("Demonstrates DisplayNameAttribute."),
 _
DisplayName("RenamedProperty")> _
Public ReadOnly Property
 MisnamedProperty() As Boolean
    Get
        Return True
    End Get
End Property
// This property exists only to demonstrate the 
// DisplayName attribute. When this control 
// is attached to a PropertyGrid control, the
// property will be appear as "RenamedProperty"
// instead of "MisnamedProperty".
[Description("Demonstrates DisplayNameAttribute.")]
[DisplayName("RenamedProperty")]
public bool MisnamedProperty
{
    get
    {
        return true;
    }
}
継承階層継承階層
System.Object
   System.Attribute
    System.ComponentModel.DisplayNameAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DisplayNameAttribute メンバ
System.ComponentModel 名前空間
GetSortedActionItems

DisplayNameAttribute コンストラクタ ()


DisplayNameAttribute コンストラクタ (String)


DisplayNameAttribute コンストラクタ

DisplayNameAttribute クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DisplayNameAttribute () DisplayNameAttribute クラスの新しいインスタンスを初期化します。
DisplayNameAttribute (String) 表示名を使用して、DisplayNameAttribute クラスの新しいインスタンスを初期化します。
参照参照

関連項目

DisplayNameAttribute クラス
DisplayNameAttribute メンバ
System.ComponentModel 名前空間

DisplayNameAttribute フィールド


パブリック フィールドパブリック フィールド

  名前 説明
パブリック フィールド Default DisplayNameAttribute の既定値を指定します。このフィールドは読み取り専用です。
参照参照

関連項目

DisplayNameAttribute クラス
System.ComponentModel 名前空間
GetSortedActionItems

DisplayNameAttribute プロパティ


DisplayNameAttribute メソッド


パブリック メソッドパブリック メソッド

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

関連項目

DisplayNameAttribute クラス
System.ComponentModel 名前空間
GetSortedActionItems

DisplayNameAttribute メンバ

引数を受け取らないプロパティ、イベント、またはパブリックな void メソッドの表示名を指定します。

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


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

関連項目

DisplayNameAttribute クラス
System.ComponentModel 名前空間
GetSortedActionItems



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DisplayNameAttribute」の関連用語

DisplayNameAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DisplayNameAttributeのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS