Example #1
0
        public string TakeFirst()
        {
            if (count == 0)
            {
                throw new InvalidOperationException();
            }
            string output = head.Data;

            head = head.Next;
            count--;
            return(output);
        }
Example #2
0
        public void Add(string data)
        {
            NodeDMAstring node     = new NodeDMAstring(data);
            NodeDMAstring tempNode = tail;

            tail = node;
            if (count == 0)
            {
                head = tail;
            }
            else
            {
                tempNode.Next = tail;
            }
            count++;
        }
Example #3
0
        public string QueueToOnestring()
        {
            int    L   = 0;
            string str = String.Empty;

            string[]      st = new string[0];
            NodeDMAstring p  = head;

            while (p != null)
            {
                Array.Resize <string>(ref st, ++L);
                st[L - 1] = p.Data.ToString();
                p         = p.Next;
            }
            foreach (string s in st)
            {
                str += s + " ";
            }
            return(str);
        }