BrowsableAttribute.Browsable プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オブジェクトが参照可能かどうかを示す値を取得します。
public:
property bool Browsable { bool get(); };
public bool Browsable { get; }
member this.Browsable : bool
Public ReadOnly Property Browsable As Boolean
プロパティ値
true オブジェクトがブロウズ可能な場合。それ以外の場合は false。
例
次の例では、 MyProperty が参照できるかどうかを確認します。 まず、コードは次の方法で MyProperty の属性を取得します。
オブジェクトのすべてのプロパティを含む PropertyDescriptorCollection を取得します。
MyPropertyを取得するためにPropertyDescriptorCollectionにインデックスを作成する。このプロパティの属性を attributes 変数に保存します。
次に、コードはmyAttributeAttributeCollection内のBrowsableAttributeの値に設定し、プロパティがブロウ可能かどうかを確認します。
// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;
// Checks to see if the property is browsable.
BrowsableAttribute^ myAttribute = dynamic_cast<BrowsableAttribute^>(attributes[ BrowsableAttribute::typeid ]);
if ( myAttribute->Browsable )
{
// Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;
// Checks to see if the property is browsable.
BrowsableAttribute myAttribute = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)];
if (myAttribute.Browsable)
{
// Insert code here.
}
' Gets the attributes for the property.
Dim attributes As AttributeCollection = TypeDescriptor.GetProperties(Me)("MyProperty").Attributes
' Checks to see if the property is browsable.
Dim myAttribute As BrowsableAttribute = CType(attributes(GetType(BrowsableAttribute)), BrowsableAttribute)
If myAttribute.Browsable Then
' Insert code here.
End If