In the previous post, you have seen how we can use Object ID during debugging to access any objects that are out of scope. This post talk about a bit extension of the same feature. You can also access these objects using the created Object ID ( Created from Watch Window) from the Immediate Window.
Consider you have following set of object and you have created an Object ID for the same – $1 .
Now, when it goes out of scope / or you closed the watch window and if you want to access the same in the Immediate Window, you can still access it.
Just type the Object ID associated with the object inside Immediate Window.
As you can see from the following screen shot, the current value of the “student” and you can access the old out of scope value in Immediate Window.
You can access any variables or methods from the object Id’s as ((ClassName)ObjectID#).Properties or ((ClassName)ObjectID#).Method(). As per our example we can access Roll for that Object as shown in below.
Hope this small tricks helps.