As I understand it...
A struct lives on the stack, right?
As a variable, yes; as a field in a class, no - it goes on the heap as
part of the object
What happens if I create a struct that
contains a reference type?
A struct (or indeed a class) never "contains" (in terms of memory
layout) a reference type; it contains (as you say later) a reference
(essentially an integeric field) to the reference tpe (which always
lives on the heap in managed code). Contrast that the other way around;
a class (or indeed a struct) with a struct field actually has a block
of memory (in it's own definition) reserved for the contained struct
(this doesn't hold true for arrays, which are referenced).
I'm guessing that there will be a pointer on the stack refering to my
reference type.
(key word: stack) - or heap, depending. But essentially you have it
correct.
Marc