May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Structures are value types. This means that they are allocated in the stack. Such behavior provides great efficiency to structures, because when they are no longer necessary, the CLR simply removes them from the stack and avoids the need of invoking the garbage collector as happens for reference types. But this is just a general rule. Structures’ members can expose any kind of .NET type and therefore reference types, too. The following revisited implementation of the Order structure provides an example, exposing an OrderDescription property of type String that is a reference type:

In this scenario, the garbage collection process ...
Read now
Unlock full access