DebuggerBrowsableAttribute(DebuggerBrowsableState) Construtor

Definição

Inicializa uma nova instância da classe 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

Um dos valores de DebuggerBrowsableState que especifica como exibir o membro.

Exceções

state não é um dos valores DebuggerBrowsableState.

Exemplos

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

[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

Comentários

Esse atributo só pode ser aplicado a propriedades e campos.

Aplica-se a