I need to run this loop and add the values to the length array each time the loop iterates, so far each time i loop the temp array is cleared so the data is getting lost each iteration. I want to resize the array and add the user input to the length array each iteration.
int[] lengthArray = new int [1];
for (int i = 0; i < lengthArray.Length; i++)
{
lengthArray[i] = int.Parse(Console.ReadLine());
int[] temp = new int [lengthArray.Length + 1] ;
temp[i] = lengthArray[i];
lengthArray = temp;
}