Sandeep Akhare wrote:
If it is true then valu types declared in class will get stored in Heap.
Only if the object of the class they are members of is allocated on the managed heap.
What if they are members of a value class?
Sandeep Akhare wrote:
And GC will deallocate them.
The GC only manages objects allocated on the managed heap.
Sandeep Akhare wrote:
So what about the performance whenever we are using value types in class
Value types are passed by value - that means a copy has to be made
every time a value type object is passed. That's going to be slower
than passing a reference I would guess. If value types are members of a
ref class then there's no difference - the ref class object holds the value
type objects.
Mark