static void Main(string[] args)
        {
            DoublyLinkedList dll = new DoublyLinkedList();

            dll.AddFirst(5);
            dll.AddFirst(3);
            dll.AddLast(7);
            dll.AddLast(9);
            Console.WriteLine(dll.RemoveFirst());
            Console.WriteLine(dll.RemoveLast());
            dll.ForEach(x => Console.WriteLine(x));
            int[] listToArray = dll.ToArray();
            Console.WriteLine(string.Join(" ", listToArray));
        }
        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();
        }