In an array with value type elements, all elements must be of the same type. An object containing an array must store information about the type of elements contained in it, but this information is stored only once for each array, and not once for each element.
Note that since arrays receive special processing in the .NET Framework (compared to other types of collections), arrays of a structural type will allow the elements of structures contained in them to act "in place." As a result, if you can limit yourself to storing the structure inside the array (and not some other type of collection) and can minimize unnecessary copying of instances of the structure, you can effectively work with structures of almost any size. If you need to store a collection of things, each of which will be associated with four values โโof Int64 and four values โโof Int32 (a total of 48 bytes), using an array of eight open-field structure elements can be more efficient and semantically cleaner than representing each thing with using four elements from Int64[] and four elements from Int32[] , or using an array of references to unexpanded modified class objects.
source share