EditorBrowsableAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
プロパティまたはメソッドをエディターで表示できるかどうかを指定します。 このクラスは継承できません。
public ref class EditorBrowsableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)]
public sealed class EditorBrowsableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)>]
type EditorBrowsableAttribute = class
inherit Attribute
Public NotInheritable Class EditorBrowsableAttribute
Inherits Attribute
- 継承
- 属性
例
次の例では、属性の適切な値を設定して、IntelliSense からクラスのプロパティを非表示にする方法を EditorBrowsableAttribute 示します。 独自のアセンブリでビルド Class1 します。
Visual Studioで、新しい Windows アプリケーション ソリューションを作成し、含まれているClass1アセンブリへの参照を追加します。 Form1 コンストラクターでインスタンスを宣言し、インスタンス Class1の名前を入力し、ピリオド キーを押してメンバーの Class1 IntelliSense ドロップダウン リストをアクティブにします。 このプロパティは Age 、ドロップダウン リストには表示されません。
#using <system.dll>
using namespace System;
using namespace System::ComponentModel;
namespace EditorBrowsableDemo
{
public ref class Class1
{
public:
Class1()
{
//
// TODO: Add constructor logic here
//
}
private:
int ageval;
public:
[EditorBrowsable(EditorBrowsableState::Never)]
property int Age
{
int get()
{
return ageval;
}
void set( int value )
{
if ( ageval != value )
{
ageval = value;
}
}
}
};
}
using System;
using System.ComponentModel;
namespace EditorBrowsableDemo
{
public class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}
int ageval;
[EditorBrowsable(EditorBrowsableState.Never)]
public int Age
{
get { return ageval; }
set
{
if (!ageval.Equals(value))
{
ageval = value;
}
}
}
}
}
Imports System.ComponentModel
Public Class Class1
Private ageval As Integer
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)> _
Public Property Age() As Integer
Get
Return ageval
End Get
Set(ByVal Value As Integer)
If Not ageval.Equals(Value) Then
ageval = Value
End If
End Set
End Property
End Class
注釈
EditorBrowsableAttribute は、プロパティまたはメソッドを表示するかどうかを示すデザイナーのヒントです。 この型は、ビジュアル デザイナーまたはテキスト エディターで使用して、ユーザーに表示される内容を決定できます。 たとえば、Visual Studioの IntelliSense エンジンでは、この属性を使用して、プロパティまたはメソッドを表示するかどうかを決定します。
Visual C# では、制御できます IntelliSense と、プロパティ ウィンドウで高度なプロパティを表示したときに、高度なメンバーを隠す 設定 ツール|オプション|テキスト エディター | c#. 対応するEditorBrowsableStateはAdvancedします。
注意
Visual C# では、EditorBrowsableAttribute同じアセンブリ内のクラスからメンバーを表示なしではありません。
コンストラクター
| EditorBrowsableAttribute() |
EditorBrowsableAttribute を既定の状態に設定して、State クラスの新しいインスタンスを初期化します。 |
| EditorBrowsableAttribute(EditorBrowsableState) |
EditorBrowsableAttribute を指定して、EditorBrowsableState クラスの新しいインスタンスを初期化します。 |
プロパティ
| State |
プロパティまたはメソッドが参照可能な状態かどうかを示す値を取得します。 |
| TypeId |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。 (継承元 Attribute) |
メソッド
| Equals(Object) |
指定したオブジェクトの値が現在の EditorBrowsableAttribute と等しいかどうかを示す値を返します。 |
| GetHashCode() |
このインスタンスのハッシュ コードを返します。 |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IsDefaultAttribute() |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
| Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
| MemberwiseClone() |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |