У меня проблемы с удалением определенного индекса в стеке, этот код удаляет только середину массива.Я хочу, чтобы он удалил только определенный индекс на (int i).
public void RemoveAt(int i)
{
if (index == -1)
throw new InvalidOperationException("stack is empty");
//==============================================================
MyList temp = new MyList();
//loop through the array
for (int x = 0; x < index; x++) //top
{
//add the removed index to temp
temp.Add(index--);
array[i] = temp;
}
while (temp == null)
{
this.Add(index--);
}
} //==============================================================