/// <summary>
        /// REmoves element at given position. (Zero based inex)
        /// </summary>
        /// <param name="iPositon"></param>
        public virtual Object Remove(int iPositon)
        {
            CAppNode currNode = First, prevNode = First;
            int      iCurrPos = 0;

            while (currNode != null)
            {
                //delete node at given position
                if ((iCurrPos == iPositon - 1) && (currNode.NextNode != null))
                {
                    //store the node that will be deleted
                    CAppNode tmpNode = currNode;

                    prevNode.NextNode = currNode.NextNode;
                    m_count--;
                    return(tmpNode.Item);
                }

                prevNode = currNode;
                currNode = currNode.NextNode;
                iCurrPos++;
            }

            return(null);
        }
        /// <summary>
        /// Inserts element at given position in the list. (Zero based)
        /// </summary>
        /// <param name="position"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool InsertAt(int position, Object obj)
        {
            int      i        = 0;
            CAppNode currNode = m_firstNode;

            while (currNode.NextNode != null)
            {
                if (i == position - 1)
                {
                    Console.WriteLine("Inserting element {0} at position :{1}", obj, position);
                    CAppNode tmpNextNode, tmpNewNode;

                    //store next node
                    tmpNextNode = currNode.NextNode;

                    //create new node
                    tmpNewNode      = new CAppNode();
                    tmpNewNode.Item = obj;

                    //set next node
                    tmpNewNode.NextNode = tmpNextNode;

                    //set current next node to new node
                    currNode.NextNode = tmpNewNode;

                    m_count++;
                    break;
                }

                currNode = currNode.NextNode;
                i++;
            }

            return(false);
        }
        /// <summary>
        /// Prints (sort of ) the content of the list
        /// </summary>
        public virtual void PrintList()
        {
            CAppNode currNode = m_firstNode;

            while (currNode != null)
            {
                Console.Write("{0}, ", currNode.Item);

                currNode = currNode.NextNode;
            }

            Console.WriteLine();
        }
        /// <summary>
        ///
        /// </summary>
        public override void PrintList()
        {
            //print the list two circles
            CAppNode currNode = First;

            while (currNode != null)
            {
                Console.Write("{0}, ", currNode.Item);

                currNode = currNode.NextNode;

                if (currNode == m_startNode)
                {
                    Console.WriteLine("");
                    break;
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public override void InsertLast(object obj)
        {
            // set last next node to null in order to insert the element
            if (Last != null)
            {
                Last.NextNode = null;
            }

            base.InsertLast(obj);

            //create circ list
            if (Last != null)
            {
                Last.NextNode = First;
            }

            //store start node in a circ list
            m_startNode = First;
        }
        /// <summary>
        /// Removes last element of the list
        /// </summary>
        public virtual void RemoveLast()
        {
            //point to current node
            CAppNode currNode = m_firstNode;

            //loop until current_node.next points to last node
            while (currNode.NextNode != m_lastNode)
            {
                currNode = currNode.NextNode;

                //Console.WriteLine("Curr item : {0}", currNode.Item);
            }

            //set second last (current node) to null
            currNode.NextNode = null;

            //set current node to last
            m_lastNode = currNode;

            m_count--;
        }
        /// <summary>
        /// Inserts element on the last position in the list
        /// </summary>
        /// <param name="o"></param>
        public virtual void InsertLast(Object obj)
        {
            //insert first element
            if (m_firstNode == null)
            {
                m_firstNode          = new CAppNode();
                m_firstNode.Item     = obj;
                m_firstNode.NextNode = null;
                m_lastNode           = m_firstNode;

                m_count++;
            }
            else
            {
                CAppNode newNode = new CAppNode();
                newNode.Item        = obj;
                m_lastNode.NextNode = newNode;
                m_lastNode          = newNode;

                m_count++;
            }
        }