I found this method at this question
public static void RemoveAt<T>(ref T[] arr, int index)
{
for (int a = index; a < arr.Length - 1; a++)
{
arr[a] = arr[a + 1];
}
Array.Resize(ref arr, arr.Length - 1);
}
Now I wanted to know if ref
is required if it is used within a nested method? So could be the method also:
public static void RemoveAt<T>(T[] arr, int index) //ref removed
with the same functionality? I already tested it and it worked - but that means you could change reference without passing Ref
Keyword. You just could do it in a sub method.