private static SwitchSectionSyntax CreateSectionWithoutStatements(SwitchSectionSyntax section) { SwitchSectionSyntax newSection = section.WithStatements(List <StatementSyntax>()); if (newSection .GetTrailingTrivia() .All(f => f.IsWhitespaceTrivia())) { newSection = newSection.WithoutTrailingTrivia(); } if (section .SyntaxTree .IsSingleLineSpan(TextSpan.FromBounds(section.Labels.Last().SpanStart, section.Span.End))) { newSection = newSection.AppendToTrailingTrivia(section.GetTrailingTrivia()); } return(newSection); }