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
属性

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

独自のアセンブリでビルド 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 では、[ツール > オプション] > テキスト エディター>の [C#] の [詳細メンバーを非表示にする] 設定を使用して、C# IntelliSense とプロパティ ウィンドウに高度なプロパティを表示するタイミングを制御できます。 対応するEditorBrowsableStateAdvancedします。

Note

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)

適用対象

こちらもご覧ください