DebuggerDisplayAttribute Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Determines how a class or field is displayed in the debugger variable windows.
Assembly: mscorlib (in mscorlib.dll)
The DebuggerDisplayAttribute type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DebuggerDisplayAttribute | Initializes a new instance of the DebuggerDisplayAttribute class. |
| Name | Description | |
|---|---|---|
![]() | Name | Gets or sets the name to display in the debugger variable windows. |
![]() | Target | Gets or sets the type of the attribute's target. |
![]() | TargetTypeName | Gets or sets the type name of the attribute's target. |
![]() | Type | Gets or sets the string to display in the type column of the debugger variable windows. |
![]() | Value | Gets the string to display in the value column of the debugger variable windows. |
| Name | Description | |
|---|---|---|
![]() | Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Note: |
|---|
The common language runtime attaches no semantics to this attribute. It is provided for use by source code debuggers. |
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 clicked to expand the debugger display for an instance of MyHashtable.
[DebuggerDisplay("Count = {count}")]
class MyHashtable
{
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.
This attribute can be applied to the following:
Classes
Structures
Delegates
Enumerations
Fields
Properties
Assemblies
The Target property specifies the target type when the attribute is used at the assembly level. The Name property can contain a string similar to the one used in the constructor, with expressions enclosed in braces. The Type property can be set blank if the type should not be displayed in the data windows.
Note: |
|---|
The properties should be used only on type proxies. |



Note: