SyntaxNode.FirstAncestorOrSelf Method

Definition

Overloads

FirstAncestorOrSelf<TNode,TArg>(Func<TNode,TArg,Boolean>, TArg, Boolean)

Gets the first node of type TNode that matches the predicate.

FirstAncestorOrSelf<TNode>(Func<TNode,Boolean>, Boolean)

Gets the first node of type TNode that matches the predicate.

FirstAncestorOrSelf<TNode,TArg>(Func<TNode,TArg,Boolean>, TArg, Boolean)

Gets the first node of type TNode that matches the predicate.

public TNode? FirstAncestorOrSelf<TNode,TArg> (Func<TNode,TArg,bool> predicate, TArg argument, bool ascendOutOfTrivia = true) where TNode : Microsoft.CodeAnalysis.SyntaxNode;
member this.FirstAncestorOrSelf : Func<'Node, 'Arg, bool (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode)> * 'Arg * bool -> 'Node (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode)
Public Function FirstAncestorOrSelf(Of TNode As SyntaxNode, TArg As SyntaxNode) (predicate As Func(Of TNode, TArg, Boolean), argument As TArg, Optional ascendOutOfTrivia As Boolean = true) As TNode

Type Parameters

TNode
TArg

Parameters

predicate
Func<TNode,TArg,Boolean>
argument
TArg
ascendOutOfTrivia
Boolean

Returns

TNode

Applies to

FirstAncestorOrSelf<TNode>(Func<TNode,Boolean>, Boolean)

Gets the first node of type TNode that matches the predicate.

public TNode FirstAncestorOrSelf<TNode> (Func<TNode,bool> predicate = default, bool ascendOutOfTrivia = true) where TNode : Microsoft.CodeAnalysis.SyntaxNode;
public TNode? FirstAncestorOrSelf<TNode> (Func<TNode,bool>? predicate = default, bool ascendOutOfTrivia = true) where TNode : Microsoft.CodeAnalysis.SyntaxNode;
member this.FirstAncestorOrSelf : Func<'Node, bool (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode)> * bool -> 'Node (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode)
Public Function FirstAncestorOrSelf(Of TNode As SyntaxNode) (Optional predicate As Func(Of TNode, Boolean) = Nothing, Optional ascendOutOfTrivia As Boolean = true) As TNode

Type Parameters

TNode

Parameters

predicate
Func<TNode,Boolean>
ascendOutOfTrivia
Boolean

Returns

TNode

Applies to