Re: C# Struct vs Class



Are these value types referenced by a reference type?

Gabriel Lozano-Morán

"Hafiz" <hafizur.rahman@xxxxxxxxx> wrote in message
news:1164432250.894043.40170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I have used in my program a class which is similar like this

class test {
int i;
int j;
int k;
}

When I create object of this type e.g 1000 copy or something for every
object it takes 20 byte of memory. to reduce the memory size I have
redeclared this in struct

like

struct test{
int i;
int j;
int k;
}

What i am seeing using profiling tool struct in C# also taking 20 byte
of memory which is same as class declaration.

This solution is very much urgent as i have to reduce the memory size ?


it is highly appreciateble if any of you have this solution.

regards,



.



Relevant Pages


Loading