You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/using-the-debuggerdisplay-attribute.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ csc /t:library autoexp.cs
78
78
## Using Expressions in DebuggerDisplay
79
79
Although you can use a general expression between the braces in a DebuggerDisplay attribute, this practice is not recommended.
80
80
81
-
A general expression in DebuggerDisplay has implicit access to the `this` pointer for the current instance of the target type only. The expression has no access to aliases, locals, or pointers. If the expression references properties, attributes on those properties are not processed. For example, the C# code `[DebuggerDisplay("Object {count - 2}"` would display `Object 6` if the field `count` was 8.
81
+
A general expression in DebuggerDisplay has implicit access to the `this` pointer for the current instance of the target type only. The expression has no access to aliases, locals, or pointers. If the expression references properties, attributes on those properties are not processed. For example, the C# code `[DebuggerDisplay("Object {count - 2}")` would display `Object 6` if the field `count` was 8.
82
82
83
83
Using expressions in DebuggerDisplay can lead to the following issues:
84
84
@@ -100,7 +100,7 @@ public sealed class MyClass
100
100
{
101
101
get
102
102
{
103
-
returnstring.Format("("Object {0}", count - 2);
103
+
returnstring.Format("Object {0}", count-2);
104
104
}
105
105
}
106
106
}
@@ -160,7 +160,9 @@ class MyHashtable
160
160
publicMyHashtable()
161
161
{
162
162
hashtable=newHashtable();
163
-
} privatestringDebuggerDisplay { get { return"Count = "+hashtable.Count); } }
163
+
}
164
+
165
+
privatestringDebuggerDisplay { get { return"Count = "+hashtable.Count); } }
[Enhancing Debugging with the Debugger Display Attributes](/dotnet/framework/debug-trace-profile/enhancing-debugging-with-the-debugger-display-attributes)
0 commit comments