BrowsableAttribute.Browsable BrowsableAttribute.Browsable BrowsableAttribute.Browsable BrowsableAttribute.Browsable Property

定義

オブジェクトが参照可能かどうかを示す値を取得します。Gets a value indicating whether an object is browsable.

public:
 property bool Browsable { bool get(); };
public bool Browsable { get; }
member this.Browsable : bool
Public ReadOnly Property Browsable As Boolean

プロパティ値

オブジェクトが参照可能である場合は true。それ以外の場合は falsetrue if the object is browsable; otherwise, false.

次の例を参照してくださいチェックするかどうかMyPropertyが参照可能。The following example checks to see whether MyProperty is browsable. まず、コードは、の属性を取得します。MyPropertyで。First the code gets the attributes for MyProperty by:

コード セットし、myAttributeの値に、BrowsableAttributeで、AttributeCollectionプロパティが参照可能かどうかを確認します。Then the code sets myAttribute to the value of the BrowsableAttribute in the AttributeCollection and checks whether the property is browsable.

// 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 

適用対象

こちらもご覧ください