Is there a built-in class in C # that implements a looped list function? Well, that is I need a regular list, but the last element, which refers to the first, as the next. Of course, all the functionality to add, delete, move, etc. must take the class. On the client side, something like:
var ring = new Ring<string>(); ring.Add("зима"); ring.Add("весна"); ring.Add("лето"); ring.Add("осень"); foreach(var item in ring) { var msg = string.Format("Наступила(о) {0}", item); MessageBox.Show(msg); Thread.Sleep(TimeSpan.FromMonthes(3)); } If there is no ready-made class, how to implement it correctly? As I understand it, I implement the interface class Ring<T> : IList<T> and add what else is needed for the intended functionality.
LinkedListcan be closed, although I'm not sure that he will like it, but this is just the doubly linked list you wanted. Or you can make your own version based on it, you can peek here at referencesource.microsoft.com/System/R/df5a6c7b6b60da4f.html - rdorn