System.Diagnostics.DebuggerDisplayAttribute Class

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

See Also: DebuggerDisplayAttribute Members


[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)]
public sealed class DebuggerDisplayAttribute : Attribute


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.


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

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


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