DisplayNameAttribute クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
引数を受け取らないプロパティ、イベント、またはパブリックな void メソッドの表示名を指定します。
public ref class DisplayNameAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property)]
public class DisplayNameAttribute : Attribute
public class DisplayNameAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property)>]
type DisplayNameAttribute = class
inherit Attribute
type DisplayNameAttribute = class
inherit Attribute
Public Class DisplayNameAttribute
Inherits Attribute
- 継承
- 属性
次のコード例では、 クラスを DisplayNameAttribute 使用して、 コントロールで を呼び出す MisnamedProperty
プロパティの名前を RenamedProperty
変更する方法を PropertyGrid 示します。 完全なコード一覧については、「方法: Windows フォーム コントロールで属性を適用する」を参照してください。
// This property exists only to demonstrate the
// DisplayName attribute. When this control
// is attached to a PropertyGrid control, the
// property will appear as "RenamedProperty"
// instead of "MisnamedProperty".
[Description("Demonstrates DisplayNameAttribute.")]
[DisplayName("RenamedProperty")]
public bool MisnamedProperty
{
get
{
return true;
}
}
' 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
既定値は、プロパティまたはイベントの名前です。 の既定の GetSortedActionItems 実装では、リフレクションを使用して、引数を受け取っていないパブリック プロパティとパブリック void メソッドを検索します。 GetSortedActionItems は各プロパティとメソッドで を DisplayNameAttribute 検索し、見つかった場合はプロパティ名またはメソッド名の代わりにその文字列を使用します。
Display |
DisplayNameAttribute クラスの新しいインスタンスを初期化します。 |
Display |
表示名を使用して、DisplayNameAttribute クラスの新しいインスタンスを初期化します。 |
Default |
DisplayNameAttribute の既定値を指定します。 このフィールドは読み取り専用です。 |
Display |
この属性に格納されている引数を受け取らないプロパティ、イベント、またはパブリックな void メソッドの表示名を取得します。 |
Display |
表示名を取得または設定します。 |
Type |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。 (継承元 Attribute) |
Equals(Object) |
2 つの DisplayNameAttribute インスタンスが等しいかどうかを判断します。 |
Get |
このインスタンスのハッシュ コードを返します。 |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Is |
この属性が既定値かどうかを判断します。 |
Is |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
_Attribute. |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
_Attribute. |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
_Attribute. |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
_Attribute. |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |
製品 | バージョン |
---|---|
.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 |
.NET Framework | 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 | 2.0, 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。