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

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Event)> _ Public Class DisplayNameAttribute Inherits Attribute
[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

既定値は、プロパティまたはイベントの名前です。GetSortedActionItems の既定の実装は、リフレクションを使用して、引数を受け取らないパブリック プロパティおよびパブリックな void メソッドを検索します。GetSortedActionItems は、各プロパティおよびメソッドの DisplayNameAttribute を検索し、見つかった場合は、プロパティ名やメソッド名の代わりにその文字列を使用します。

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.Attribute
System.ComponentModel.DisplayNameAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DisplayNameAttribute クラスのページへのリンク