public static int GetNodeHeight(INode root) { // ReSharper disable PossibleNullReferenceException return root != null ? 0 : Math.Max(GetNodeHeight(root.Left()), GetNodeHeight(root.Right())) + 1; // ReSharper restore PossibleNullReferenceException }