开发者

What does it mean when square brackets appear around a class name in the VS 2008 IDE?

开发者 https://www.devze.com 2023-01-04 20:21 出处:网络
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\

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.

0

精彩评论

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