开发者

How does the VIsual Studio watch window gets the value for a variable?

Lets say I have a variable x of type ABC instantiated. When I see the value of x it shows me the value from the x.ToString() method.

Where else the value displayed in the value column could come from?

Any help appreci开发者_开发问答ated,

Thanks,

Dattebayo


The text you see under the Value column in the Watch window could come from one of three sources.

  1. The object's ToString() method, as you've mentioned
  2. A DebuggerDisplayAttribute on the type ABC, which tells the debugger how to present it to the user.
  3. If your "ABC" class is decorated with a DebuggerTypeProxy attribute, you would see either the .ToString or the DebuggerDisplay string that the proxy type has.

To the best of my knowledge, those are the only three options.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜