Question

I have read about this topic in CLR C# but theres something im wondering about.

It is said that an instance of a class only stores its fields, a type object pointer (pointing to its type object) and its sync block index in the heap. the type object itself also has a type object pointer. so at which object does the type object`s type object pointer point to? shouldnt be all important data and metadata for the class already be in the type object itself?

hope you get my point its quite confusing ;)

Was it helpful?

Solution

From Jeffrey Richter's "CLR via C#" book, Chapter 4 "Type Fundamentals":

Of course, the system.type object is an object itself and therefore it also has a type object pointer member in it, and it is logical to ask what this member refers to. It refers to itself because the system.type object is itself an "instance" of a type object.

So there you go: It points to itself (as you probably expected).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top