public int LevelOfNode(TreeNode tn) { int x=0; if(tn.Parent!=null) return LevelOfNode(tn.Parent)+1; else return x; }