DebuggerBrowsableAttribute(DebuggerBrowsableState) Constructor

Definición

Inicializa una nueva instancia de la clase DebuggerBrowsableAttribute.

public:
 DebuggerBrowsableAttribute(System::Diagnostics::DebuggerBrowsableState state);
public DebuggerBrowsableAttribute (System.Diagnostics.DebuggerBrowsableState state);
new System.Diagnostics.DebuggerBrowsableAttribute : System.Diagnostics.DebuggerBrowsableState -> System.Diagnostics.DebuggerBrowsableAttribute
Public Sub New (state As DebuggerBrowsableState)

Parámetros

state
DebuggerBrowsableState

Uno de los valores de DebuggerBrowsableState que especifica cómo se va a mostrar el miembro.

Excepciones

state no es uno de los valores de DebuggerBrowsableState .

Ejemplos

En el ejemplo de código siguiente se muestra el uso de un DebuggerBrowsableAttribute atributo para indicar al depurador que no muestre la raíz (nombre de propiedad) de la Keys propiedad, sino para mostrar los elementos de la matriz que Keys obtiene. Este ejemplo de código es parte de un ejemplo más grande proporcionado para la clase DebuggerDisplayAttribute.

[DebuggerBrowsable(DebuggerBrowsableState::RootHidden)]
property array<KeyValuePairs^>^ Keys
{
    array<KeyValuePairs^>^ get()
    {
        array<KeyValuePairs^>^ keys = gcnew array<KeyValuePairs^>(hashtable->Count);

        IEnumerator^ ie = hashtable->Keys->GetEnumerator();
        int i = 0;
        Object^ key;
        while (ie->MoveNext())
        {
            key = ie->Current;
            keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]);
            i++;
        }
        return keys;
    }
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePairs[] Keys
{
    get
    {
        KeyValuePairs[] keys = new KeyValuePairs[hashtable.Count];

        int i = 0;
        foreach(object key in hashtable.Keys)
        {
            keys[i] = new KeyValuePairs(hashtable, key, hashtable[key]);
            i++;
        }
        return keys;
    }
}
<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)> _
ReadOnly Property Keys as KeyValuePairs()
    Get
        Dim nkeys(hashtable.Count) as KeyValuePairs

        Dim i as Integer = 0
        For Each key As Object In hashtable.Keys
            nkeys(i) = New KeyValuePairs(hashtable, key, hashtable(key))
            i = i + 1
        Next
        Return nkeys
    End Get
End Property

Comentarios

Este atributo solo se puede aplicar a propiedades y campos.

Se aplica a