Given my current extension method:
public static List<char> rotate(this List<char> currentList, int periodes) { if (periodes != 1) { int x = currentList.Count() - 1; return rotate(currentList.Skip(x). Concat(currentList.Take(x)).ToList<char>(), periodes - 1); } return currentList; }
The initial state:
ring = new List<char>() { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
Current result for ring.rotate(10);
JABCDEFGHI IJABCDEFGH HIJABCDEFG GHIJABCDEF FGHIJABCDE Recursive Steps EFGHIJABCD DEFGHIJABC CDEFGHIJAB BCDEFGHIJA
ABCDEFGHIJ Result
Is there a way to get rid of this while loop and any possibility to integrate the repetition into a LINQ query?
Best
Henric
c # linq
Henrik P. Hessel
source share