Select Next Object in List (Infinite)

I have a list where I have organised my targets in an alphabetical manner.

public List<Transform> targets;

Unsure on how to cycle through it. I can add them all to the list and it works great No point posting code, I’m looking for a way to do something. I have tried using an Input key to add and subtract via an int. Though it ends up going to high and off the list (Then breaking).

either using foreach such as

foreach(var t in targets)
{
    ...
}

OR

targets.ForEach(...);

you can also access the List like an array, using an index

targets[0] is the first element, targets[1] is the next.

you just need to iterate thru it, checking that you don’t exceed targets.Count-1 (zero based)

if that’s not what you meant, please try to elaborate.