[英]How to inspect “this” object in Visual Studio while debugging?
When you debug your program, and for example you set a breakpoint as in here:当您调试程序时,例如您在此处设置断点:
void foo(string s)
{
(*) if (s=="bar")
...
}
(*) denotes breakpoint (*) 表示断点
you can move mouse cursor over "s" and inspect the content of it.您可以将鼠标 cursor 移动到“s”上并检查其内容。
The question is how to do the same (ie inspect object) but not any argument or variable, but "this" object?问题是如何做同样的事情(即检查对象)但不是任何参数或变量,而是“这个”object?
My case: I get exception at some point, I trace call stack, and let's say I would like to inspect "this" object of the 4th method of the call stack (for example).我的情况:我在某个时候遇到异常,我跟踪调用堆栈,假设我想检查调用堆栈的第四个方法的“this”object(例如)。
Quick Watch Window快速手表 Window
this
this
Add Watch Window添加手表 Window
Debug -> Windows -> Watch -> Watch 1
Debug -> Windows -> Watch -> Watch 1
Name
field this
and press Enterthis
中输入Name
字段并按 Enter Immediate Window立即 Window
Debug -> Windows -> Immediate Window
Debug -> Windows -> Immediate Window
this
and press Enterthis
内容并按 Enter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.