System.Diagnostics.DebuggerDisplayAttribute Class

Determines how a class or field is displayed in the debugger variable windows.

See Also: DebuggerDisplayAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Delegate | System.AttributeTargets.All, AllowMultiple=true)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class DebuggerDisplayAttribute : Attribute

Remarks

The DebuggerDisplayAttribute.#ctor(string) constructor has a single argument: a string to be displayed in the value column for instances of the type. This string 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 MyHashtable.

Example

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

For information about using this attribute in Visual Studio, see Using DebuggerDisplay Attribute.

Requirements

Namespace: System.Diagnostics
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0