Arbel.Roslyn.ConfigureAwaitChecker.DocumentExtensions.ReplaceAsync C# (CSharp) 메소드

ReplaceAsync() 공개 정적인 메소드

public static ReplaceAsync ( this document, Microsoft.CodeAnalysis.SyntaxNode oldSyntax, Microsoft.CodeAnalysis.SyntaxNode newSyntax, CancellationToken cancellationToken ) : Task
document this
oldSyntax Microsoft.CodeAnalysis.SyntaxNode
newSyntax Microsoft.CodeAnalysis.SyntaxNode
cancellationToken System.Threading.CancellationToken
리턴 Task
        public static async Task<Document> ReplaceAsync(this Document document, SyntaxNode oldSyntax,
            SyntaxNode newSyntax, CancellationToken cancellationToken)
        {
            var oldRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
            var newRoot = oldRoot.ReplaceNode(oldSyntax, newSyntax);
            var newDocument = document.WithSyntaxRoot(newRoot);
            return newDocument;
        }
    }
DocumentExtensions