S
Sathyaish
Structs are value types, strings are ref types. If you have something
like this:
struct foo
{
System.String str;
}
foo TheDayToday;
then, where's
TheDayToday.str
going to be stored?
(a) The string is going to be stored on the stack;
(b) The struct is going to be stored on the stack with a 32-bit
System.IntPtr/System.UInt32 also copied on the stack holding the
address/reference to the actual string allocated on the heap.
like this:
struct foo
{
System.String str;
}
foo TheDayToday;
then, where's
TheDayToday.str
going to be stored?
(a) The string is going to be stored on the stack;
(b) The struct is going to be stored on the stack with a 32-bit
System.IntPtr/System.UInt32 also copied on the stack holding the
address/reference to the actual string allocated on the heap.