DebuggerDisplayAttribute Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

System..::..Object
  System..::..Attribute
    System.Diagnostics..::..DebuggerDisplayAttribute

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

[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple = true)]
public sealed class DebuggerDisplayAttribute : Attribute

The DebuggerDisplayAttribute type exposes the following members.

  NameDescription
Public methodDebuggerDisplayAttributeInitializes a new instance of the DebuggerDisplayAttribute class.
Top

  NameDescription
Public propertyNameGets or sets the name to display in the debugger variable windows.
Public propertyTargetGets or sets the type of the attribute's target.
Public propertyTargetTypeNameGets or sets the type name of the attribute's target.
Public propertyTypeGets or sets the string to display in the type column of the debugger variable windows.
Public propertyValueGets the string to display in the value column of the debugger variable windows.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The DebuggerDisplayAttribute 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;
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: