This documentation is archived and is not being maintained.

DebuggerTypeProxyAttribute Class

Specifies the display proxy for a type.

Namespace:  System.Diagnostics
Assembly:  mscorlib (in mscorlib.dll)

[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true)]
public sealed class DebuggerTypeProxyAttribute : Attribute

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.

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;

      public KeyValuePairs[] Keys
             KeyValuePairs[] keys = new KeyValuePairs[hashtable.Count];

            int i = 0;
            foreach(object key in hashtable.Keys)
               keys[i] = new KeyValuePairs(hashtable, key, hashtable[key]);
         return keys;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0