Partager via


DebuggerDisplayAttribute Constructor

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of the DebuggerDisplayAttribute class.

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

Syntax

'Declaration
Public Sub New ( _
    value As String _
)
public DebuggerDisplayAttribute(
    string value
)

Parameters

  • value
    Type: System.String
    The string to be displayed in the value column for instances of the type. An empty string ("") causes the value column to be hidden.

Remarks

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 clicked to expand the debugger display for an instance of MyTable.

[c#]

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

Attributes that are 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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.