Reputation: 2883
Is it possible to call a method with parameter(s) within the DebuggerDisplay attribute? I did not find helpful information for this problem in the MSDN article Using the DebuggerDisplay Attribute.
I try to call the ToString
method with a string parameter "d"
; but the following did not work:
[DebuggerDisplay(@"{ToString(""d"")}")]
public class ...
I know it is recommended to use a private property instead of complex expressions. But is it nevertheless possible with an expression?
Upvotes: 4
Views: 672
Reputation: 503
I don't think it will allow that. But why cant you do this:
[DebuggerDisplay(@"{DebugDisplay}")]
public class ...
private string DebugDisplay
{
get
{
return ToString("d");
}
}
Upvotes: 4