DebuggerBrowsableAttribute(DebuggerBrowsableState) Costruttore
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Inizializza una nuova istanza della 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)
Parametri
- state
- DebuggerBrowsableState
Uno dei DebuggerBrowsableState valori che specifica come visualizzare il membro.
Eccezioni
state non è uno dei DebuggerBrowsableState valori.
Esempio
Nell'esempio di codice seguente viene illustrato l'uso di un DebuggerBrowsableAttribute attributo per indicare al debugger di non visualizzare la radice (nome proprietà) della Keys proprietà, ma di visualizzare gli elementi della matrice che Keys ottiene. Questo esempio di codice fa parte di un esempio più ampio fornito per la 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
Commenti
Questo attributo può essere applicato solo alle proprietà e ai campi.