Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DebuggerDisplayAttribute Constructor

Note: This constructor is new in the .NET Framework version 2.0.

Initializes a new instance of the DebuggerDisplayAttribute class.

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

public DebuggerDisplayAttribute (
	string value
)
public DebuggerDisplayAttribute (
	String value
)
public function DebuggerDisplayAttribute (
	value : String
)

Parameters

value

The string to be displayed in the value column for instances of the type; a null reference (Nothing in Visual Basic) is equivalent to an empty string ("").

The value parameter can contain braces ({ and }). The text within a pair of braces is evaluated as the name of a field, property, or method. For example, the following C# code causes "Count = 4" to be displayed when the plus sign (+) is selected to expand the debugger display for an instance of MyTable.

[c#]

[DebuggerDisplay("Count = {count}")]
class MyTable
{
    public int count = 4;
}

Attributes applied to properties referenced in the expression are not processed. For some compilers, a general expression may be allowed that has only implicit access to this reference for the current instance of the target type. The expression is limited; there is no access to aliases, locals, or pointers.

The following code example causes the value of the Count property from the inherited Hashtable class to be displayed when the + is selected to expand the debugger display for an instance of MyHashtable. You must run the complete example, provided for the DebuggerDisplayAttribute class, to see the results.

[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(HashtableDebugView))]
class MyHashtable : Hashtable

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.