Re: C# Struct vs Class
- From: "Just D" <no@xxxxxxxxxxx>
- Date: Wed, 29 Nov 2006 16:05:36 -0700
Doesn't that mean that this is rounded to one paragraph in memory plus some
pointer? 16 + 4 = 20. Correct or not?
"Hafiz" <hafizur.rahman@xxxxxxxxx> wrote in message
news:1164776062.898230.167800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Actually when I only declare struct it keep this on stack. but when I
add this struct to any arraylist then it keeps those in Heap. Then it
already takes memory for reference.
So my assumption is if we use struct but keep reference for further use
then struct and class is same?
Any idea ?
Thanks to all for replying this.
Kevien Lee wrote:
//to reduce the memory size I have redeclared this in struct
The struct is alloc in stack,but the class was on the heap.still there
is same size,but you should consider the value type and ref type
boxing/unboxing operate,it is the most cost
.
- Follow-Ups:
- Re: C# Struct vs Class
- From: Just D
- Re: C# Struct vs Class
- References:
- Re: C# Struct vs Class
- From: Hafiz
- Re: C# Struct vs Class
- Prev by Date: Re: C# Struct vs Class
- Next by Date: Re: C# Struct vs Class
- Previous by thread: Re: C# Struct vs Class
- Next by thread: Re: C# Struct vs Class
- Index(es):
Relevant Pages
|
Loading