DebuggerBrowsableAttribute(DebuggerBrowsableState) Construtor

Definição

Inicializa uma nova instância da DebuggerBrowsableAttribute classe.

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

Um dos DebuggerBrowsableState valores que especifica como mostrar o membro.

Exceções

state não é um dos valores DebuggerBrowsableState .

Exemplos

O exemplo de código seguinte mostra o uso de um DebuggerBrowsableAttribute atributo para instruir o depurador a não mostrar a raiz (nome da propriedade) da Keys propriedade, mas sim a mostrar os elementos do array que Keys obtém. Este exemplo de código faz parte de um exemplo maior fornecido para a DebuggerDisplayAttribute classe.

[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

Observações

Este atributo pode ser aplicado apenas a propriedades e corpos.

Aplica-se a