It was necessary to implement a ring list. Made through extension methods. But there is one nuance. How to implement the return from the method of the first value in the node? In this case, I always return the second value ("Tanya") at the first pass, then after the last node, the transition to the first value.
class Program { static void Main(string[] args) { // Π‘ΠΎΠ·Π΄Π°Π΄ΠΈΠΌ ΡΠ²ΡΠ·Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ LinkedList<string> linkedList = new LinkedList<string>(); // ΠΠΎΠ±Π°Π²ΠΈΠΌ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² linkedList.AddFirst("ΠΠ°ΡΡ"); linkedList.AddFirst("ΠΠ΅ΡΡ"); linkedList.AddFirst("Π’Π°Π½Ρ"); linkedList.AddFirst("ΠΠΎΠ»Ρ"); // ΠΡΠΎΠ±ΡΠ°Π·ΠΈΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ Π² ΠΏΡΡΠΌΠΎΠΌ Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠΈ LinkedListNode<string> node; Console.WriteLine("ΠΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΊΠΎΠ»Π»Π΅ΠΊΡΠΈΠΈ Π² ΠΏΡΡΠΌΠΎΠΌ Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠΈ: "); for (node = linkedList.First; node != null; node = node.Next) Console.Write(node.Value + "\t"); Console.WriteLine(); var result = GetValue(linkedList.First); Console.WriteLine($"+++++++ {result} ++++++++"); Console.ReadKey(); } private static string GetValue(LinkedListNode<string> node) { node = CircularLinkedList.NextOrFirst(node); return node.Value; } } Extension method for a single-linked list:
public static class CircularLinkedList { public static LinkedListNode<T> NextOrFirst<T>(this LinkedListNode<T> current) { return current.Next ?? current.List.First; } public static LinkedListNode<T> PreviousOrLast<T>(this LinkedListNode<T> current) { return current.Previous ?? current.List.Last; } } 
CircularLinkedList.NextOrFirst(node);, so Kolya has Next, which is Tanya, because you see Tanya instead of Kolya - tym32167