I'm writing some code to automatically parse/evaluate DebuggerDisplay
strings for unit testing purposes. I'm curious, does the ,nq
directive only have effect for strings? I see that if I write
[DebuggerDisplay("{c,nq}")]
public class D { public C c = new C(); }
public class C { }
Then a new D()
will present as {C}
in the debugger. Removing the ,nq
from the display string has the same effect. Only if I change the type of c
to a string, like this
[DebuggerDisplay("{c,nq}")]
public class D { public string c = "foo"; }
does removing/keeping ,nq
seem to have effect (it results in "foo"
and foo
, respectively). So does ,nq
only matter when you're trying to display a string field/member?
'nq' literally means 'no quotes' (strip leading quotes from object value). So, yes, only when trying to display string members.
https://blogs.msdn.microsoft.com/jaredpar/2011/03/18/debuggerdisplay-attribute-best-practices/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With