EditorBrowsableAttribute クラス
定義
プロパティまたはメソッドをエディターで表示できるかどうかを指定します。Specifies that a property or method is viewable in an editor. このクラスは継承できません。This class cannot be inherited.
public ref class EditorBrowsableAttribute sealed : Attribute
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)]
public sealed class EditorBrowsableAttribute : Attribute
type EditorBrowsableAttribute = class
inherit 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 います。The following sample demonstrates how to hide a property of a class from IntelliSense by setting the appropriate value for the EditorBrowsableAttribute attribute. Class1
独自のアセンブリでビルドします。Build Class1
in its own assembly.
Visual Studio で、新しい Windows アプリケーションソリューションを作成し、を含むアセンブリへの参照を追加し Class1
ます。In Visual Studio, create a new Windows Application solution, and add a reference to the assembly which contains Class1
. Form1 コンストラクターで、のインスタンスを宣言し、 Class1
インスタンスの名前を入力し、ピリオドキーを押して、メンバーの IntelliSense のドロップダウンリストをアクティブにし Class1
ます。In the Form1 constructor, declare an instance of Class1
, type the name of the instance, and press the period key to activate the IntelliSense drop-down list of Class1
members. この Age
プロパティは、ドロップダウンリストに表示されません。The Age
property does not appear in the drop-down list.
#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 は、プロパティまたはメソッドを表示するかどうかを示すヒントです。EditorBrowsableAttribute is a hint to a designer indicating whether a property or method is to be displayed. ビジュアルデザイナーまたはテキストエディターでこの型を使用して、ユーザーに表示される内容を決定できます。You can use this type in a visual designer or text editor to determine what is visible to the user. たとえば、Visual Studio の IntelliSense エンジンでは、この属性を使用して、プロパティまたはメソッドを表示するかどうかを決定します。For example, the IntelliSense engine in Visual Studio uses this attribute to determine whether to show a property or method.
Visual C# では、制御できます IntelliSense と、プロパティ ウィンドウで高度なプロパティを表示したときに、高度なメンバーを隠す設定ツール|オプション|テキスト エディター | c#.In Visual C#, you can control when advanced properties appear in IntelliSense and the Properties Window with the Hide Advanced Members setting under Tools | Options | Text Editor | C#. 対応するEditorBrowsableStateはAdvancedします。The corresponding EditorBrowsableState is Advanced.
注意
Visual C# では、EditorBrowsableAttribute同じアセンブリ内のクラスからメンバーを表示なしではありません。In Visual C#, EditorBrowsableAttribute does not suppress members from a class in the same assembly.
コンストラクター
EditorBrowsableAttribute() |
EditorBrowsableAttribute を既定の状態に設定して、State クラスの新しいインスタンスを初期化します。Initializes a new instance of the EditorBrowsableAttribute class with State set to the default state. |
EditorBrowsableAttribute(EditorBrowsableState) |
EditorBrowsableAttribute を指定して、EditorBrowsableState クラスの新しいインスタンスを初期化します。Initializes a new instance of the EditorBrowsableAttribute class with an EditorBrowsableState. |
プロパティ
State |
プロパティまたはメソッドが参照可能な状態かどうかを示す値を取得します。Gets the browsable state of the property or method. |
TypeId |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。When implemented in a derived class, gets a unique identifier for this Attribute. (継承元 Attribute) |
メソッド
Equals(Object) |
指定したオブジェクトの値が現在の EditorBrowsableAttribute と等しいかどうかを示す値を返します。Returns whether the value of the given object is equal to the current EditorBrowsableAttribute. |
GetHashCode() |
このインスタンスのハッシュ コードを返します。Returns the hash code for this instance. |
GetType() |
現在のインスタンスの Type を取得します。Gets the Type of the current instance. (継承元 Object) |
IsDefaultAttribute() |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (継承元 Attribute) |
MemberwiseClone() |
現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object. (継承元 Object) |
ToString() |
現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object. (継承元 Object) |
明示的なインターフェイスの実装
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。Maps a set of names to a corresponding set of dispatch identifiers. (継承元 Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。Retrieves the type information for an object, which can be used to get the type information for an interface. (継承元 Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。Retrieves the number of type information interfaces that an object provides (either 0 or 1). (継承元 Attribute) |
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。Provides access to properties and methods exposed by an object. (継承元 Attribute) |