Share via


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.

Inheritance Hierarchy

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

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

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Enum Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Delegate, AllowMultiple := True)> _
Public NotInheritable Class DebuggerDisplayAttribute _
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple = true)]
public sealed class DebuggerDisplayAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Delegate, AllowMultiple = true)]
public ref class DebuggerDisplayAttribute sealed : public Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple = true)>]
type DebuggerDisplayAttribute =  
    class
        inherit Attribute
    end
public final class DebuggerDisplayAttribute extends Attribute

The DebuggerDisplayAttribute type exposes the following members.

Constructors

  Name Description
Public method DebuggerDisplayAttribute Initializes a new instance of the DebuggerDisplayAttribute class.

Top

Properties

  Name Description
Public property Name Gets or sets the name to display in the debugger variable windows.
Public property Target Gets or sets the type of the attribute's target.
Public property TargetTypeName Gets or sets the type name of the attribute's target.
Public property Type Gets or sets the string to display in the type column of the debugger variable windows.
Public property Value Gets the string to display in the value column of the debugger variable windows.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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

Thread Safety

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

See Also

Reference

System.Diagnostics Namespace