static void Main(string[] args) { var myList = new DoublyLinkedList(); myList.AddFirst(6666); myList.AddFirst(5555); myList.AddFirst(4444); myList.AddFirst(3333); myList.AddFirst(2222); myList.AddFirst(1111); int[] arr = myList.ToArray(); Console.WriteLine(arr.Length); for (int i = 0; i < arr.Length; i++) { Console.WriteLine(arr[i]); } }
static void Main(string[] args) { DoublyLinkedList <string> doublyLinkedList = new DoublyLinkedList <string>(); for (int i = 1; i <= 10; i++) { doublyLinkedList.AddFirst("Pesho" + i); } for (int i = 1; i <= 10; i++) { doublyLinkedList.AddLast("Gosho" + i); } doublyLinkedList.ForEach(n => Console.Write(n + " ")); Console.WriteLine(); for (int i = 1; i <= 10; i++) { doublyLinkedList.RemoveFirst(); } doublyLinkedList.ForEach(n => Console.Write(n + " ")); Console.WriteLine(); string[] arr = doublyLinkedList.ToArray(); }