Skip to content

Commit fad3f9e

Browse files
authored
Update using-the-debuggerdisplay-attribute.md
- Fixing code sample (proper quotation pairs). - Adding new line
1 parent 39765e9 commit fad3f9e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/debugger/using-the-debuggerdisplay-attribute.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ csc /t:library autoexp.cs
7878
## Using Expressions in DebuggerDisplay
7979
Although you can use a general expression between the braces in a DebuggerDisplay attribute, this practice is not recommended.
8080

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.
8282

8383
Using expressions in DebuggerDisplay can lead to the following issues:
8484

@@ -100,7 +100,7 @@ public sealed class MyClass
100100
{       
101101
get
102102
{
103-
return string.Format("("Object {0}", count - 2);
103+
return string.Format("Object {0}", count - 2);
104104
}   
105105
}
106106
}
@@ -160,7 +160,9 @@ class MyHashtable
160160
public MyHashtable()
161161
{
162162
hashtable = new Hashtable();
163-
} private string DebuggerDisplay { get { return "Count = " + hashtable.Count); } }
163+
}
164+
165+
private string DebuggerDisplay { get { return "Count = " + hashtable.Count); } }
164166

165167
private class HashtableDebugView
166168
{
@@ -194,4 +196,4 @@ class MyHashtable
194196
[Using DebuggerTypeProxy Attribute](../debugger/using-debuggertypeproxy-attribute.md)
195197
[Create custom views of managed objects](../debugger/create-custom-views-of-dot-managed-objects.md)
196198
[Format specifiers in C#](../debugger/format-specifiers-in-csharp.md)
197-
[Enhancing Debugging with the Debugger Display Attributes](/dotnet/framework/debug-trace-profile/enhancing-debugging-with-the-debugger-display-attributes)
199+
[Enhancing Debugging with the Debugger Display Attributes](/dotnet/framework/debug-trace-profile/enhancing-debugging-with-the-debugger-display-attributes)

0 commit comments

Comments
 (0)