Exemple #1
0
 /// <summary>
 /// Gets the depth of the given node in the tree.
 /// </summary>
 /// <returns></returns>
 public int depth()
 {
     if (Object.ReferenceEquals(Parent, null))
     {
         return(0);              //depth zero at the root
     }
     return(Parent.depth() + 1); //the depth of any node is one more than its parent's
 }