public void CopyTo(T[] array, int arrayIndex)
        {
            DoubleNode <T> current = Head;

            while (current != null)
            {
                array[arrayIndex++] = current.Value;
                current             = current.Next;
            }
        }
        public IEnumerator <T> GetEnumerator()
        {
            DoubleNode <T> current = Head;

            while (current != null)
            {
                yield return(current.Value);

                current = current.Next;
            }
        }
        /// <summary>
        /// Removes the last element from the list
        /// </summary>
        public void RemoveLast()
        {
            if (Count == 1)
            {
                Head = null;
                Tail = null;
            }

            Tail      = Tail.Previous;
            Tail.Next = null;

            Count--;
        }
        /// <summary>
        /// Removes the first element from the list;
        /// </summary>
        public void RemoveFirst()
        {
            Head = Head.Next;

            Count--;

            if (Count == 0)
            {
                Tail = null;
            }
            else
            {
                Head.Previous = null;
            }
        }
        /// <summary>
        /// This method adds the given node to the end of the list.
        /// </summary>
        /// <param name="node">The node to add at the last of the list</param>
        public void AddLast(DoubleNode <T> node)
        {
            if (Count == 0)
            {
                Head = node;
            }
            else
            {
                Tail.Next     = node;
                node.Previous = Tail;
            }

            Tail = node;
            Count++;
        }
        /// <summary>
        /// This method adds the given DoubleNode<> to the begining of the list.
        /// </summary>
        /// <param name="node">The DoubleNode<T> to add at the begining of the list.</param>
        public void AddFirst(DoubleNode <T> node)
        {
            DoubleNode <T> temp = Head;

            Head          = node;
            Head.Next     = temp;
            temp.Previous = Head;

            Count++;

            if (Count == 1)
            {
                Tail = Head;
            }
        }
        public bool Contains(T item)
        {
            DoubleNode <T> current = Head;

            while (current != null)
            {
                if (current.Value.Equals(item))
                {
                    return(true);
                }

                current = current.Next;
            }

            return(false);
        }
        public bool Remove(T item)
        {
            DoubleNode <T> current  = Head;
            DoubleNode <T> previous = null;

            while (current != null)
            {
                if (current.Value.Equals(item))
                {
                    if (previous != null)
                    {
                        previous.Next = current.Next;

                        if (current.Next == null)
                        {
                            Tail = previous;
                        }
                        else
                        {
                            current.Next.Previous = previous;
                        }

                        Count--;
                    }
                    else
                    {
                        RemoveFirst();
                    }

                    return(true);
                }

                previous = current;
                current  = current.Next;
            }

            return(false);
        }