So, a couple of questions, actually:
- An
int
(Int32
) is specified to be (obviously) 32 bits. What about anint?
(Nullable<int>
)? My gut tells me that it would be 32 bits for the integer plus 8 more bits for the boolean, but perhaps the implementation is more intricate than that. - I would have answered my own question using
sizeof(int?)
; but asint?
is a managed type this is not allowed. I understand that the size of a type may be platform-dependent, and that in the case of objects which contain references to other objects, asizeof
-like operation would be misleading. However, is there a way to get a "baseline" size (i.e., what the size of a newly instantiated instance would be) for a managed type, given the current environment?