Udostępnij za pośrednictwem


Document.GetSyntaxTreeAsync(CancellationToken) Method

Definition

Gets the SyntaxTree for this document asynchronously.

public System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxTree> GetSyntaxTreeAsync (System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxTree?> GetSyntaxTreeAsync (System.Threading.CancellationToken cancellationToken = default);
member this.GetSyntaxTreeAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.SyntaxTree>
Public Function GetSyntaxTreeAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of SyntaxTree)

Parameters

cancellationToken
CancellationToken

Returns

The returned syntax tree can be null if the SupportsSyntaxTree returns false. This function may cause computation to occur the first time it is called, but will return a cached result every subsequent time. SyntaxTree's can hold onto their roots lazily. So calls to GetRoot(CancellationToken) or GetRootAsync(CancellationToken) may end up causing computation to occur at that point.

Applies to