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?
Asked
Active
Viewed 871 times
1

Scott Hutchinson
- 1,703
- 12
- 22

Mashmagar
- 2,556
- 2
- 29
- 38
1 Answers
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
-
@[Palak.Maheria](http://stackoverflow.com/users/2432065/palak-maheria), didn't understand why you changed from [square] brackets to {curly} brackets? – aquadeep Apr 15 '14 at 10:10
-
Neither do I understand – Johan Boulé Oct 23 '19 at 16:48