EditorBrowsableAttribute クラス

定義

クラスまたはメンバーがエディターで表示可能であることを指定します。 このクラスは継承できません。

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
継承
EditorBrowsableAttribute
属性

次の例では、 EditorBrowsableAttribute 属性の適切な値を設定して、IntelliSense からクラスのプロパティを非表示にする方法を示します。

独自のアセンブリで Class1 をビルドします。 次に、Visual Studioで新しいプロジェクトを作成し、Class1を含むアセンブリへの参照を追加します。 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.ComponentModel;

namespace EditorBrowsableDemo;

public class Class1
{
    public Class1() { }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public int Age
    {
        get; set;
    }

    public int Height
    {
        get; set;
    }
}
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 Studioでは、 Tools Options Text Editor < C# の下の Hide Advanced Members 設定を使用して、C# IntelliSense とプロパティ ウィンドウに詳細プロパティを表示するタイミングを制御できます。 対応する EditorBrowsableStateAdvanced

Note

C# では、 EditorBrowsableAttribute はメンバーが同じアセンブリ内のクラスによって参照されることを抑制しません。

コンストラクター

名前 説明
EditorBrowsableAttribute()

Stateが既定の状態に設定されたEditorBrowsableAttribute クラスの新しいインスタンスを初期化します。

EditorBrowsableAttribute(EditorBrowsableState)

EditorBrowsableStateを使用して、EditorBrowsableAttribute クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
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)

適用対象

こちらもご覧ください