コード例 #1
0
 public void Peek()
 {
     if (top == null)
     {
         Console.WriteLine("Top: null");
     }
     else
     {
         Console.WriteLine("Top: " + top.ToString());
     }
 }
コード例 #2
0
        public void DisplayStack()
        {
            LinkedStackNode <Type> workingNode = top;

            Console.WriteLine("<LinkedStack>:");

            while (workingNode != null)
            {
                Console.WriteLine(workingNode.ToString());

                workingNode = workingNode.GetNextNode();
            }
        }
コード例 #3
0
        public override string ToString()
        {
            string stackAsString = "";

            LinkedStackNode <Type> workingNode = top;

            while (workingNode != null)
            {
                stackAsString += workingNode.ToString() + "\n";

                workingNode = workingNode.GetNextNode();
            }

            return(stackAsString);
        }