Beispiel #1
0
 public void AddElement(int input)
 {
     try
     {
         StackHelper.CheckIfInt(input);
     }
     catch (Exception e)
     {
         throw e;
     }
     stack.Add(input);
 }
Beispiel #2
0
        public void RemoveElement(int elementPosition)
        {
            try
            {
                StackHelper.CheckIfInt(elementPosition);
            }
            catch (Exception e)
            {
                throw e;
            }

            stack.Remove(stack.ElementAt(elementPosition));
        }
Beispiel #3
0
        public int GetPrevious()
        {
            try
            {
                StackHelper.CheckIfInt(elementPosition);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(stack.ElementAt(elementPosition - 1));
        }