Allen4Tech
Allen4Tech

Reputation: 2184

Where's the ValueType stored when CLR initialize the data structure to store them

I know Value Type instances stored in the stack and Reference Type instances stored in the heap. But, after the CLR ensure all the assemblies which define the Type have loaded, it will create some data structures to store the type object, the reference type object will stored in the heap, where's the value type objects stored?

Upvotes: 2

Views: 148

Answers (2)

Guffa
Guffa

Reputation: 700362

The Type objects for different types are reference types, i.e. Type is a class, so they are all stored on the heap.


Note that value types are only stored on the stack if they are local variables in a method. If they are members of a class, they will be stored on the heap as part of the instance of that class.

Upvotes: 2

Shani Elharrar
Shani Elharrar

Reputation: 657

Value Type objects that are members of a Reference Type objects will be stored in the heap.

This Thread Will help you to understand more.

Upvotes: 0

Related Questions