SyntaxNode.FindToken(Int32, Boolean) Method

Definition

Finds a descendant token of this node whose span includes the supplied position.

public Microsoft.CodeAnalysis.SyntaxToken FindToken (int position, bool findInsideTrivia = false);
member this.FindToken : int * bool -> Microsoft.CodeAnalysis.SyntaxToken
Public Function FindToken (position As Integer, Optional findInsideTrivia As Boolean = false) As SyntaxToken

Parameters

position
Int32

The character position of the token relative to the beginning of the file.

findInsideTrivia
Boolean

True to return tokens that are part of trivia. If false finds the token whose full span (including trivia) includes the position.

Returns

SyntaxToken

Applies to