DebuggerBrowsableAttribute(DebuggerBrowsableState) Konstruktor

Definition

Initierar en ny instans av DebuggerBrowsableAttribute klassen.

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)

Parametrar

state
DebuggerBrowsableState

Ett av de DebuggerBrowsableState värden som anger hur medlemmen ska visas.

Undantag

state är inte ett av DebuggerBrowsableState värdena.

Exempel

I följande kodexempel visas användningen av ett DebuggerBrowsableAttribute attribut för att instruera felsökaren att inte visa egenskapens rot (egenskapsnamn), Keys utan att visa elementen i matrisen som Keys hämtas. Det här kodexemplet är en del av ett större exempel för DebuggerDisplayAttribute klassen.

[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

Kommentarer

Det här attributet kan endast tillämpas på egenskaper och fält.

Gäller för