If we pass an array of structs as method parameter, in the method body do we have a reference to an array of structs, or a new array of structs?
3 Answers
When you declare an array of value types, .NET allocates memory on the heap not stack. So it is always referred to be its reference.
The only exception is stackalloc where a memory area is allocated on the stack and can be used unsafely and it is faster that heap access.
Comments
Array is a class in the .net framework so if you create a struct arrays so you will have a reference type ,i am not commenting how and where these will be stored whether it is stack or heap because it is pure implementational details but Microsoft implementation of reference type will go on the HEAP.