private static IfStatementSyntax GenerateIfStatement(List <IfStatementSyntax> list) { if (list.Count == 1) { return(list[0]); } IfStatementSyntax ifStatment = list[list.Count - 2].WithElse(ElseClause(list[list.Count - 1])); var text = ifStatment.NormalizeWhitespace().ToFullString(); for (int i = list.Count - 3; i >= 0; i--) { ifStatment = list[i].WithElse(ElseClause(ifStatment)); } return(ifStatment); }