BrowsableAttribute.Browsable Property
Gets a value indicating whether an object is browsable.
Assembly: System (in System.dll)
The following example checks to see whether MyProperty is browsable. First the code gets the attributes for MyProperty by:
-
Retrieving a PropertyDescriptorCollection with all the properties for the object.
-
Indexing into the PropertyDescriptorCollection to get MyProperty.
-
Saving the attributes for this property in the attributes variable.
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. }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.