Where __value objects are allocated?

  • Thread starter Thread starter Bae,Hyun-jik
  • Start date Start date
B

Bae,Hyun-jik

Where are __value objects allocated? I guess __value object is same to basic
__value objects such as int,char,float, but C# compiler demands using new
keyword even to __value classes.

Please reply. Thanks in advance.

Regards,
Hyun-jik Bae
 
Where are __value objects allocated? I guess __value object is same to
basic __value objects such as int,char,float, but C# compiler demands
using new keyword even to __value classes.

Depends on where they are declared. In general, I think of __value objects
to be declared "inline". If you declare a value on the local stack, then
that's where it will be allocated. If it is declared as a member of a __gc
class, then it will always be "allocated" inside the memory allocated for
objects of the __gc class itself (on the managed heap).. And there's always
boxing, which allows you to take a __value on the stack and take it to the
managed head....
 
Back
Top