1

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 square brackets on some of them?

Scott Hutchinson
  • 1,703
  • 12
  • 22
Mashmagar
  • 2,556
  • 2
  • 29
  • 38

1 Answers1

0

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.

Palak.Maheria
  • 1,497
  • 2
  • 15
  • 32
aquadeep
  • 107
  • 1
  • 3