Create objects on the stack using stackalloc

Imagine we want to create a method that generates an array composed by square values of its indexes and the only parameter we want to pass to this method is the size of the array. A straight-forward approach would be this: View the code on Gist. We could have displayed the values of the array […]