Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Type Object Pointer

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 ;)

like image 882
Julian Herbold Avatar asked Feb 18 '14 11:02

Julian Herbold


1 Answers

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).

like image 115
Matthew Watson Avatar answered Oct 06 '22 00:10

Matthew Watson