Click or drag to resize

CSharpExtensionsIndexOfTNode Method (SyntaxListTNode, SyntaxKind)



Returns the index of the first node of a specified kind in the node list.

Namespace:  Microsoft.CodeAnalysis
Assembly:  Microsoft.CodeAnalysis.CSharp (in Microsoft.CodeAnalysis.CSharp.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public static int IndexOf<TNode>(
	this SyntaxList<TNode> list,
	SyntaxKind kind
)
where TNode : SyntaxNode

Parameters

list
Type: Microsoft.CodeAnalysisSyntaxListTNode
Node list.
kind
Type: Microsoft.CodeAnalysis.CSharpSyntaxKind
The SyntaxKind to find.

Type Parameters

TNode

Return Value

Type: Int32
Returns non-negative index if the list contains a node which matches kind, -1 otherwise.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SyntaxListTNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also