public int CalculateMaxDepth() { return(FixPoint.Fix <List <Element>, int>( // recursive lambda f => listElement => listElement == null || listElement.Count == 0 ? 0 : 1 + listElement.Select(e => f(e.element)).Max()) (this.element)); }