DebuggerTypeProxyAttribute Constructores
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Inicializa una nueva instancia de la DebuggerTypeProxyAttribute clase utilizando el tipo del proxy.
Sobrecargas
| Nombre | Description |
|---|---|
| DebuggerTypeProxyAttribute(String) |
Inicializa una nueva instancia de la DebuggerTypeProxyAttribute clase con el nombre de tipo del proxy. |
| DebuggerTypeProxyAttribute(Type) |
Inicializa una nueva instancia de la DebuggerTypeProxyAttribute clase utilizando el tipo del proxy. |
DebuggerTypeProxyAttribute(String)
Inicializa una nueva instancia de la DebuggerTypeProxyAttribute clase con el nombre de 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)
Parámetros
- typeName
- String
Nombre de tipo del tipo de proxy.
Comentarios
El depurador crea una nueva instancia de la clase proxy del tipo cada vez que necesita mostrar una variable del tipo objetivo. Esto puede tener implicaciones de rendimiento. Como resultado, no debe hacer más trabajo en el constructor que absolutamente necesario.
Se aplica a
DebuggerTypeProxyAttribute(Type)
Inicializa una nueva instancia de la DebuggerTypeProxyAttribute clase utilizando el 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)
Parámetros
- type
- Type
Tipo de proxy.
Excepciones
type es null.
Ejemplos
En el DebuggerTypeProxyAttribute(Type) ejemplo de código siguiente se muestra el uso del constructor para especificar un proxy de visualización del depurador. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la DebuggerDisplayAttribute clase .
[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
Comentarios
El depurador crea una nueva instancia de la clase proxy del tipo cada vez que necesita mostrar una variable del tipo objetivo. Esto puede tener implicaciones de rendimiento. Como resultado, no debe hacer más trabajo en el constructor que absolutamente necesario.