DebuggerTypeProxyAttribute Costruttori
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 DebuggerTypeProxyAttribute classe utilizzando il tipo del proxy.
Overload
| Nome | Descrizione |
|---|---|
| DebuggerTypeProxyAttribute(String) |
Inizializza una nuova istanza della DebuggerTypeProxyAttribute classe utilizzando il nome del tipo del proxy. |
| DebuggerTypeProxyAttribute(Type) |
Inizializza una nuova istanza della DebuggerTypeProxyAttribute classe utilizzando il tipo del proxy. |
DebuggerTypeProxyAttribute(String)
Inizializza una nuova istanza della DebuggerTypeProxyAttribute classe utilizzando il nome del tipo del proxy.
public:
DebuggerTypeProxyAttribute(System::String ^ typeName);
public DebuggerTypeProxyAttribute(string typeName);
new System.Diagnostics.DebuggerTypeProxyAttribute : string -> System.Diagnostics.DebuggerTypeProxyAttribute
Public Sub New (typeName As String)
Parametri
- typeName
- String
Nome del tipo di proxy.
Commenti
Il debugger crea una nuova istanza della classe proxy di tipo ogni volta che deve visualizzare una variabile del tipo di destinazione. Ciò può avere implicazioni sulle prestazioni. Di conseguenza, non è consigliabile eseguire altre operazioni nel costruttore di quanto non sia assolutamente necessario.
Si applica a
DebuggerTypeProxyAttribute(Type)
Inizializza una nuova istanza della DebuggerTypeProxyAttribute classe utilizzando il tipo del proxy.
public:
DebuggerTypeProxyAttribute(Type ^ type);
public DebuggerTypeProxyAttribute(Type type);
new System.Diagnostics.DebuggerTypeProxyAttribute : Type -> System.Diagnostics.DebuggerTypeProxyAttribute
Public Sub New (type As Type)
Parametri
- type
- Type
Tipo di proxy.
Eccezioni
type è null.
Esempio
Nell'esempio di codice seguente viene illustrato l'uso del DebuggerTypeProxyAttribute(Type) costruttore per specificare un proxy di visualizzazione del debugger. Questo esempio di codice fa parte di un esempio più ampio fornito per la DebuggerDisplayAttribute classe .
[DebuggerTypeProxy(typeof(HashtableDebugView))]
class MyHashtable : Hashtable
{
private const string TestString = "This should not appear in the debug window.";
internal class HashtableDebugView
{
private Hashtable hashtable;
public const string TestString = "This should appear in the debug window.";
public HashtableDebugView(Hashtable hashtable)
{
this.hashtable = hashtable;
}
[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;
}
}
}
}
<DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(GetType(MyHashtable.HashtableDebugView))> _
Class MyHashtable
Inherits Hashtable
Private Const TestString As String = "This should not appear in the debug window."
Friend Class HashtableDebugView
Private hashtable As Hashtable
Public Shared TestString As String = "This should appear in the debug window."
Public Sub New(ByVal hashtable As Hashtable)
Me.hashtable = hashtable
End Sub
<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
End Class
End Class
Commenti
Il debugger crea una nuova istanza della classe proxy di tipo ogni volta che deve visualizzare una variabile del tipo di destinazione. Ciò può avere implicazioni sulle prestazioni. Di conseguenza, non è consigliabile eseguire altre operazioni nel costruttore di quanto non sia assolutamente necessario.