Implement ToArray method and Enumerator for AbstractTree.