DebuggerTypeProxyAttribute Construtores
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Inicializa uma nova instância da DebuggerTypeProxyAttribute classe usando o tipo do proxy.
Sobrecargas
| Name | Description |
|---|---|
| DebuggerTypeProxyAttribute(String) |
Inicializa uma nova instância da DebuggerTypeProxyAttribute classe usando o nome de tipo do proxy. |
| DebuggerTypeProxyAttribute(Type) |
Inicializa uma nova instância da DebuggerTypeProxyAttribute classe usando o tipo do proxy. |
DebuggerTypeProxyAttribute(String)
Inicializa uma nova instância da DebuggerTypeProxyAttribute classe usando o nome de tipo do 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
O nome do tipo proxy (proxy).
Observações
O depurador cria uma nova instância da classe proxy do tipo sempre que precisa exibir uma variável do tipo de destino. Isso pode ter implicações no desempenho. Como resultado, não deve fazer mais trabalho no construtor do que o absolutamente necessário.
Aplica-se a
DebuggerTypeProxyAttribute(Type)
Inicializa uma nova instância da DebuggerTypeProxyAttribute classe usando o tipo do 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
O tipo de proxy.
Exceções
type é null.
Exemplos
O exemplo de código seguinte mostra a utilização do DebuggerTypeProxyAttribute(Type) construtor para especificar um proxy de exibição do depurador. Este exemplo de código faz parte de um exemplo maior fornecido para a 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
Observações
O depurador cria uma nova instância da classe proxy do tipo sempre que precisa exibir uma variável do tipo de destino. Isso pode ter implicações no desempenho. Como resultado, não deve fazer mais trabalho no construtor do que o absolutamente necessário.