I have a list like this:
public List<ProjectHistoryModel> ProjectHistoryModel = new List<ProjectHistoryModel>();
Now I have Enqueue and Dequeue method like:
private void Enqueue(ProjectHistoryModel model)
{
ProjectHistoryModel.Add(model);
}
private void Dequeue(List<ProjectHistoryModel> model)
{
model.RemoveAt(4);
}
It add and remove items correctly except for one reason, when I add new item I want always add it to index [0], for example if I have a list with indexes 0,1,2,3,4,5
and new item comes I have a validation if (ProjectHistoryModel.Count == 5)
so dequeue runs and remove index 5 now Enqueue method runs and add new item, but it added as index 5, I want to add it as index 0 and go throught all the others. How can I achieve that?