What does it mean when square brackets appear around a class name in the VS 2008 IDE?
In my watch window in VS2008, I'm looking at an IEnumerable<classX>
. Expanding the IEnumerable
, some elements are shown with a Value of {classX}
. Others appear with a Value of {[classX]}
. What's the difference? Why are there开发者_JAVA百科 square brackets on some of them?
The class inside the curly brackets represents the dynamic type of the object you are referring to. e.g. Below code should explain this...
class Parent1
{
int p1;
};
class Child1:Parent1
{
int c1;
}
class Child2:Parent1
{
int c2;
}
void main()
{
Parent1 objP1 = new Child1();
}
Now if you see objP1 in debugger windows, you would see [Child1] which is the dynamic type for objP1. Expanding this further, you can see contents that belong to Child1.
精彩评论