DebuggerTypeProxyAttribute Class
Specifies the display proxy for a type.
Assembly: mscorlib (in mscorlib.dll)
Note Use this attribute when you need to significantly and fundamentally change the debugging view of a type, but not change the type itself.
The DebuggerTypeProxyAttribute attribute is used to specify a display proxy for a type, allowing a developer to tailor the view for the type. This attribute can be used at the assembly level as well, in which case the Target property specifies the type for which the proxy will be used. In general, this attribute specifies a private nested type that occurs within the type to which the attribute is applied. An expression evaluator that supports type viewers checks for this attribute when a type is displayed. If the attribute is found, the expression evaluator substitutes the display proxy type for the type the attribute is applied to.
When the DebuggerBrowsableAttribute is present, the debugger variable window displays only the public members of the proxy type. Private members are not displayed. The behavior of the data window is not changed by attribute-enhanced views.
To avoid unnecessary performance penalties, expression evaluators should not examine the attributes on the display proxy of the type unless the type is expanded, either through the user clicking the plus sign (+) next to the type in a data window, or through the application of the DebuggerBrowsableAttribute attribute. Therefore, it is recommended that no attributes be applied to the display type. Attributes can and should be applied within the body of the display type.
The following code example shows the use of the DebuggerTypeProxyAttribute to specify a private nested type to be used as a debugger display proxy. This code example is part of a larger example provided for the DebuggerDisplayAttribute class.
<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 Const TestString As String = "This should appear in the debug window." Public Sub New(ByVal hashtable As Hashtable) Me.hashtable = hashtable End Sub 'New End Class 'HashtableDebugView End Class 'MyHashtable
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.