In Visual Studio for C# there is this cool feature (Make Object ID), which allows you to assign an ID to the object you're debugging. it is very important to note that the object has to physically exist before you can assign an ID to it. so, you can not make this at design time. Even at run time you can not create the ID before the object has been created.
Here is how to use this cool feature given the following program.
StringCollection ls = new StringCollection();
ls.Add("ayman");
ls.Add("ayman");
foreach (string ss in ls)
{
MessageBox.Show(ss);
}
The foreach loop above declares a string called ss. this ss is not the same ss every time a loop cycle is created. to enjoy the pleasure of seeing this fact, you can set a break point at the foreach line, and then when the debugger stops at the foreach line click F10 once so that ss is created and then hover over the variable ss. at this time, right click and choose "Make object ID" as per the picture below (notice that the debugger has executed the foreach line already and is about to enter the foreach block)
There is also delete object Id if you care to use it.
No comments:
Post a Comment