   [C#] Relacing last element in list so that previous elements decrease in index
  If I have a List:   List<int> a = new List<int>();   a.Add(0);   a.Add(1);   a.Add(2);   a.Add(3);So:a[0] = 0a[1] = 1a[2] = 2a[3] = 3How can I decrease each element by 1 place in the list every time I replace the last element.So for example if I now change the last element to 5, the previous elements all move down one index and the first element is removed so that the list would be as follows:a[0] = 1a[1] = 2a[2] = 3a[3] = 5If I were to add another number to the end of the list (say 17) then the list would then look like:a[0] = 2a[1] = 3a[2] = 5a[3] = 17I hope that makes sense.  Thank you for any info you might have on this.   
  What you want is a FIFO (first in first out) container, a'la System.Collections.Queue. linkJust call Dequeue() before Enqueue(item).   ;  The general data structure used for this is called ring buffer.   ;  Thanks for the pointers, unfortunately it seems that a change in approach is required when drawing using Indices. if (decal_VerticesIndex >= GameConstants.DECAL_MAX * GameConstants.QUAD_NUMBER_OF_VERTICES) {decal_VerticesIndex = 0; } if (vertices_Queue.Count >= GameConstants.DECAL_MAX * GameConstants.QUAD_NUMBER_OF_VERTICES) {for (int i = 0; i < GameConstants.QUAD_NUMBER_OF_VERTICES; i++){    vertices_Queue.Dequeue();}for (int i = 0; i < GameConstants.QUAD_NUMBER_OF_INDICES; i++){    indices_Queue.Dequeue();} } vertices_Queue.Enqueue(quad_Default.Vertices[0]); vertices_Queue.Enqueue(quad_Default.Vertices[1]); vertices_Queue.Enqueue(quad_Default.Vertices[2]); vertices_Queue.Enqueue(quad_Default.Vertices[3]); Console.WriteLine(decal_VerticesIndex); // Do the same for the current Quad's Indices indices_Queue.Enqueue((short)(quad_Default.Indices[0] + decal_VerticesIndex)); indices_Queue.Enqueue((short)(quad_Default.Indices[1] + decal_VerticesIndex)); indices_Queue.Enqueue((short)(quad_Default.Indices[2] + decal_VerticesIndex)); indices_Queue.Enqueue((short)(quad_Default.Indices[3] + decal_VerticesIndex)); indices_Queue.Enqueue((short)(quad_Default.Indices[4] + decal_VerticesIndex)); indices_Queue.Enqueue((short)(quad_Default.Indices[5] + decal_VerticesIndex)); decal_VerticesIndex += GameConstants.QUAD_NUMBER_OF_VERTICES;With the method above the Vertices are being queued correctly.However, when drawing the Vertices using the Indices then the draw order is incorrect.This is because the Indices are being cycled through by the value of:decal_VerticesIndexSo although the vertices draw correctly, the last vertices added won't be drawn over the previous vertices, messing up the draw order because the value of the Index is within range but in the wrong order (highest Index being drawn on top of lowest).What would you recommend in terms of assigning Indices so that they draw in the correct order, last Vertex in the Queue will be draw over the previous Vertex?In other words the highest Index is always given to the last Vertex added/queued.Thanks again.   