using System.Collections;
using System.Collections.Generic;
public static void Main()
var weaponList = new ContinuousList<Weapon>();
weaponList.Add(new Sword());
weaponList.Add(new Axe());
foreach(var weapon in weaponList)
Console.WriteLine(weapon);
public class Sword: Weapon{}
public class Axe: Weapon{}
public class ContinuousList<T> : IEnumerable<T>
private List<T> internalList = new List<T>();
private int currentIndex = 0;
public void Add(T item) => internalList.Add(item);
public T Current {get => internalList[currentIndex];}
if(currentIndex >= internalList.Count) currentIndex = 0;
public void MovePrevious()
if(currentIndex <= 0) currentIndex = internalList.Count - 1;
public IEnumerator<T> GetEnumerator() => internalList.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();