private static bool HasDifferentModifiers(SyntaxList<AccessorDeclarationSyntax> accessors) { var accessor1 = accessors.First(); var modifiers = GetModifierKinds(accessor1).ToImmutableHashSet(); return accessors.Skip(1).Any(a => !modifiers.SetEquals(GetModifierKinds(a))); }
private static SyntaxList<StatementSyntax> CreateNewStatementList( SyntaxList<StatementSyntax> oldStatements, LocalDeclarationStatementSyntax localDeclaration, StatementSyntax newStatement, int statementIndex) { return oldStatements.Take(statementIndex) .Concat(localDeclaration.WithLeadingTrivia(oldStatements.Skip(statementIndex).First().GetLeadingTrivia())) .Concat(newStatement.WithoutLeadingTrivia()) .Concat(oldStatements.Skip(statementIndex + 1)) .ToSyntaxList(); }