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)
        {
            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();
        }