Skip to content

Instantly share code, notes, and snippets.

@JohanLarsson
Created June 5, 2013 20:53
Show Gist options
  • Save JohanLarsson/5717237 to your computer and use it in GitHub Desktop.
Save JohanLarsson/5717237 to your computer and use it in GitHub Desktop.
public static class ListEx
{
public static IEnumerable<T> WrappingEnumerator<T>(this List<T> list)
{
var i = 0;
while (true)
{
yield return list[i];
i = (i < (list.Count - 1))
? i + 1
: 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment