DebuggerTypeProxyAttribute Constructor (Type^)
Initializes a new instance of the DebuggerTypeProxyAttribute class using the type of the proxy.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- type
-
Type:
System::Type^
The proxy type.
| Exception | Condition |
|---|---|
| ArgumentNullException | 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.
[DebuggerTypeProxy(HashtableDebugView::typeid)] ref class MyHashtable : Hashtable { private: static const String^ TestString = "This should not appear in the debug window."; internal: ref class HashtableDebugView { private: Hashtable^ hashtable; public: static const String^ TestString = "This should appear in the debug window."; HashtableDebugView(Hashtable^ hashtable) { this->hashtable = hashtable; } [DebuggerBrowsable(DebuggerBrowsableState::RootHidden)] property array<KeyValuePairs^>^ Keys { array<KeyValuePairs^>^ get() { array<KeyValuePairs^>^ keys = gcnew array<KeyValuePairs^>(hashtable->Count); IEnumerator^ ie = hashtable->Keys->GetEnumerator(); int i = 0; Object^ key; while (ie->MoveNext()) { key = ie->Current; keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]); i++; } return keys; } } }; };
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1