public IEnumerable <T> Traverse(TraverseOrder order) { if (_root == null) { throw new InvalidOperationException(); } var traversal = default(IEnumerable <T>); switch (order) { case TraverseOrder.InOrder: traversal = _root.TraverseInOrder(); break; case TraverseOrder.PostOrder: traversal = _root.TraversePostOrder(); break; case TraverseOrder.PreOrder: traversal = _root.TraversePreOrder(); break; case TraverseOrder.LevelOrder: traversal = _root.TraverseLevelOrder(); break; } return(traversal); }