This documentation is archived and is not being maintained.

EditorBrowsableAttribute Class

Specifies that a property or method is viewable in an editor. This class cannot be inherited.

For a list of all members of this type, see EditorBrowsableAttribute Members.

System.Object
   System.Attribute
      System.ComponentModel.EditorBrowsableAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Struct _
   Or AttributeTargets.Enum Or AttributeTargets.Constructor Or _
   AttributeTargets.Method Or AttributeTargets.Property Or _
   AttributeTargets.Field Or AttributeTargets.Event Or _
   AttributeTargets.Interface Or AttributeTargets.Delegate)>
NotInheritable Public Class EditorBrowsableAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
   AttributeTargets.Enum | AttributeTargets.Constructor |
   AttributeTargets.Method | AttributeTargets.Property |
   AttributeTargets.Field | AttributeTargets.Event |
   AttributeTargets.Interface | AttributeTargets.Delegate)]
public sealed class EditorBrowsableAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::Class | AttributeTargets::Struct
   | AttributeTargets::Enum | AttributeTargets::Constructor |
   AttributeTargets::Method | AttributeTargets::Property |
   AttributeTargets::Field | AttributeTargets::Event |
   AttributeTargets::Interface | AttributeTargets::Delegate)]
public __gc __sealed class EditorBrowsableAttribute : public
   Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
   AttributeTargets.Enum | AttributeTargets.Constructor |
   AttributeTargets.Method | AttributeTargets.Property |
   AttributeTargets.Field | AttributeTargets.Event |
   AttributeTargets.Interface | AttributeTargets.Delegate)
class EditorBrowsableAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

You can use this class in a visual designer or text editor to determine what is visible to the user. For example, the IntelliSense engine in Visual Studio .NET uses this attribute to determine whether to show a method or property.

Example

[Visual Basic, C#, C++] The following sample demonstrates how to hide a property of a control from IntelliSense by setting the appropriate value for the EditorBrowsableAttribute attribute. After you open a new application, add a reference to the control and declare an instance of the control, IntelliSense does not display the Age property in the drop-down list box.

[Visual Basic] 
Private ageval As Integer

<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)> _
Public Property Age() As Integer
    Get
        Return ageval
    End Get
    Set(ByVal Value As Integer)
        If Not ageval.Equals(Value) Then
            ageval = Value
        End If
    End Set
End Property

[C#] 
int ageval;
[EditorBrowsable(EditorBrowsableState.Never)]
public int Age
{ 
    get { return ageval; }
    set 
    {
        if (!ageval.Equals(value)) 
        {
            ageval = value;
        }
    }
}

[C++] 
int ageval;

[EditorBrowsable(EditorBrowsableState::Never)]
__property int get_Age()
{
    return ageval;
}

[EditorBrowsable(EditorBrowsableState::Never)]
__property void set_Age(int value)
{
    if (ageval != value)
    {
        ageval = value;
    }

}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.ComponentModel

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System (in System.dll)

See Also

EditorBrowsableAttribute Members | System.ComponentModel Namespace | EditorBrowsableState

Show: