Skip to main content

SyntaxExtensions.TryGetContainingList(StatementSyntax, SyntaxList<StatementSyntax>) Method

Containing Type: SyntaxExtensions

Assembly: Roslynator.CSharp.dll

Gets a list the specified statement is contained in. This method succeeds if the statement is in a block's statements or a switch section's statements.

public static bool TryGetContainingList(this Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax statement, out Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax> statements)

Parameters

statement StatementSyntax

statements SyntaxList<StatementSyntax>

Returns

Boolean

True if the statement is contained in the list; otherwise, false.