public void PopPage() { _ = PageStack ?? throw new NullReferenceException("Can't go back a page when there are no pages in the stack"); _ = (PageStack.Count <= 0) ? throw new IndexOutOfRangeException("Can't go back a page when there are no pages in the stack") : 0; _ = (PageStackIndex - 1 < 0) ? throw new IndexOutOfRangeException("Can't go back a page while being on the first page") : 0; DestroyPage(); PageStack.RemoveAt(PageStackIndex); currentPage = PageStack[PageStackIndex - 1]; PageStackIndex = PageStack.Count - 1; ShowPage(); }