BrowsableAttribute.Browsable Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value indicating whether an object is browsable.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

public bool Browsable { get; }

Property Value

Type: System.Boolean

true if the object is browsable; otherwise, false.

The following example checks to see whether MyProperty is browsable. First the code gets the attributes for MyProperty by:

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 = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)];
 if(myAttribute.Browsable) {
    // Insert code here.
 }

.NET Framework
Available since 1.1
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show: