public void Peek() { if (top == null) { Console.WriteLine("Top: null"); } else { Console.WriteLine("Top: " + top.ToString()); } }
public void DisplayStack() { LinkedStackNode <Type> workingNode = top; Console.WriteLine("<LinkedStack>:"); while (workingNode != null) { Console.WriteLine(workingNode.ToString()); workingNode = workingNode.GetNextNode(); } }
public override string ToString() { string stackAsString = ""; LinkedStackNode <Type> workingNode = top; while (workingNode != null) { stackAsString += workingNode.ToString() + "\n"; workingNode = workingNode.GetNextNode(); } return(stackAsString); }