Q:

Get reference to variable and avoid copying it unnecessarily

Suppose I have a class like this:
class Array{
    int[] values;
}

Now suppose I have a class that stores a lot of Arrays:
class ArrayOfArrays{
    Array[] arrays;
}

Suppose, for some reason, I want to get the last Array of arrays and put in a variable (for better readability). In C, I would do like Array last = &ArrayOfArraysObject.arrays[lastIndex]. As I won't modify it, for better performance, I don't need to copy the whole array, just a reference do the job.
Can I have this kind of behaviour in C# ? (without using function calls, I don't want to create a function just to use the keyword ref, it looks like overkill)

A:

You could create a public property that returns the last element of arrays.
class ArrayOfArrays
{
    Array[] arrays;

    public Array LastOfArrays { get { return arrays.Last(); } }
}

Test it:
var aoa = new ArrayOfArrays();
// Initialize and enter data here

//When you want to use the last item:
var last = aoa.LastOfArrays;
last.values[0] = 333;

Now, aoa.arrays[LastElement].values[0] would also be 333. So you essentially do keep the reference here, and does not copy the entire array.
Confirmation:

