BrowsableAttribute(Boolean) コンストラクター

定義

BrowsableAttribute クラスの新しいインスタンスを初期化します。

public:
 BrowsableAttribute(bool browsable);
public BrowsableAttribute(bool browsable);
new System.ComponentModel.BrowsableAttribute : bool -> System.ComponentModel.BrowsableAttribute
Public Sub New (browsable As Boolean)

パラメーター

browsable
Boolean

true デザイン時にプロパティまたはイベントを変更できる場合。それ以外の場合は false。 既定値は true です。

次の例では、プロパティをブロウズ可能としてマークします。 このコードでは、新しい BrowsableAttributeを作成し、その値を BrowsableAttribute.Yes に設定して、プロパティにバインドします。

   [Browsable(true)]
   int get()
   {
      // Insert code here.
      return 0;
   }
   void set( int value )
   {
      
      // Insert code here.
   }
}
[Browsable(true)]
public int MyProperty
{
    get =>
        // Insert code here.
        0;
    set
    {
        // Insert code here.
    }
}
<Browsable(True)> _
Public Property MyProperty() As Integer
    Get
        ' Insert code here.
        Return 0
    End Get
    Set
        ' Insert code here.
    End Set
End Property

注釈

BrowsableAttribute値のtrueコンストラクターでプロパティをマークすると、この属性の値は定数メンバー Yesに設定されます。 BrowsableAttribute値のfalse コンストラクターでマークされたプロパティの場合、値はNo。 したがって、コードでこの属性の値を確認する場合は、属性を BrowsableAttribute.Yes または BrowsableAttribute.Noとして指定する必要があります。

適用対象

こちらもご覧ください