According to the documentation of vs: MakeArrayType() represents one dimensional array with a lower bound of zero. MakeArrayType(1) represents an array with a specified number of dimensions.
For example if the UnderlyingSystemType is int the return type of MakeArrayType() is
System.Int32[] and the return type of MakeArrayType(1) is System.Int32[*].
What is the difference between those types.
According to the documentation of vs: MakeArrayType() represents one dimensional array with a lower
Share
There is a subtle difference between
.MakeArrayType()and.MakeArrayType(1)as you’ve seen from the type that is returned (Int32[]versusInt32[*]). According to the documentation for.MakeArrayType():So when you call
.MakeArrayType()it returns a Vector (which is a special thing that always has one dimension). Calling.MakeArrayType(1)makes a multi-dimensional array (not a Vector) – it just happens that it only has a single dimension.The difference between a Vector and an Array are pretty technical but basically Vectors get special treatment by the CLR so there are additional IL instructions that work with them and that can make them more efficient. For more information about the difference between Arrays and Vectors see: http://markettorrent.com/community/7968#Vectors vs. Arrays