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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top