Hi,
you would have to check out the difference between reference types and value
types. say you have 2 integers a and b.
doing a = b would copy the value of b into a. say you have 2 objects a and b
doing a = b would not create a new object but makes both a and b point to
the same object. you can modify the object using either a or b. so now the
object is referenced by 2 variables. when this count drops to zero garbage
collection takes place(not right after it drops to zero, it may take some
time to do the garbage collecgtion). structures are value types. classes are
reference types. this is a starting point. you will have tro read futher in
some good c# book.
regards.
Lingesh
"Daniel" wrote:
Structs exist for perfomance reasons, they are like light classes and
because they are in the stack they don't have to wait to be collected by the
GC
Regards,
Daniel Carbajal
MVP
"Flip" <[remove]ph******@hotmail.com> wrote in message
news:eD**************@TK2MSFTNGP14.phx.gbl... I'm coming from the java world, so I'm sorry if this is a simplistic
question. I've read enough to be dangerous :< and would like a quick
overview.
In java, everything with implemenation is implemented as a class. In C#
there are not only classes but structs, enumerations. I know one is on
the heap (classes?) and one's on the stack (structs?), but more than that, why
are they broken out? It just seems to be a bit over complicated for
something I don't quite see the benefits of? Any gentle nudges in the
right direction would be appreciated. Thanks.
This posting is provided "AS IS" with no warranties, and confers no rights