DebuggerTypeProxyAttribute Constructor (Type)


Initializes a new instance of the DebuggerTypeProxyAttribute class using the type of the proxy.

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

public DebuggerTypeProxyAttribute(
	Type type


Type: System.Type

The proxy type.

Exception Condition

type is null.

The debugger creates a new instance of the type proxy class every time it needs to display a variable of the target type. This can have performance implications. As a result, you should not do any more work in the constructor than absolutely necessary.

The following code example shows the use of the DebuggerTypeProxyAttribute(Type) constructor to specify 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;

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top