示例#1
0
        private static async Task <Document> AddPartialModifier(Document document, ClassDeclarationSyntax typeDecl, CancellationToken cancellationToken)
        {
            var newTypeDecl = typeDecl.AddPartialModifier();

            var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false) as CompilationUnitSyntax;

            var newRoolt = root.ReplaceNode(typeDecl, newTypeDecl)
                           .WithAdditionalAnnotations(Formatter.Annotation);

            document = document.WithSyntaxRoot(newRoolt);
            return(document);
        }