Partager via


SyntaxNodeExtensions.InsertTokensBefore<TRoot> Méthode

Définition

Crée une arborescence de nœuds avec de nouveaux jetons insérés avant le jeton spécifié.

public:
generic <typename TRoot>
 where TRoot : Microsoft::CodeAnalysis::SyntaxNode[System::Runtime::CompilerServices::Extension]
 static TRoot InsertTokensBefore(TRoot root, Microsoft::CodeAnalysis::SyntaxToken tokenInList, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::SyntaxToken> ^ newTokens);
public static TRoot InsertTokensBefore<TRoot>(this TRoot root, Microsoft.CodeAnalysis.SyntaxToken tokenInList, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxToken> newTokens) where TRoot : Microsoft.CodeAnalysis.SyntaxNode;
static member InsertTokensBefore : 'Root * Microsoft.CodeAnalysis.SyntaxToken * seq<Microsoft.CodeAnalysis.SyntaxToken> -> 'Root (requires 'Root :> Microsoft.CodeAnalysis.SyntaxNode)
<Extension()>
Public Function InsertTokensBefore(Of TRoot As SyntaxNode) (root As TRoot, tokenInList As SyntaxToken, newTokens As IEnumerable(Of SyntaxToken)) As TRoot

Paramètres de type

TRoot

Type du nœud racine.

Paramètres

root
TRoot

Racine de l’arborescence des nœuds.

tokenInList
SyntaxToken

Jeton à insérer avant. Il doit s’agir d’un élément direct d’un SyntaxTokenList (tel qu’un modificateur dans une liste de modificateurs) et d’un descendant du nœud racine. Les nouveaux jetons seront insérés avant ce jeton dans cette liste. Si le jeton ne fait pas partie d’un SyntaxTokenListjeton, un InvalidOperationException jeton est levée.

newTokens
IEnumerable<SyntaxToken>

Séquence de jetons à insérer dans l’arborescence immédiatement avant le jeton spécifié.

Retours

TRoot

Exceptions

Levée quand tokenInList n’est pas un élément d’un SyntaxTokenList.

S’applique à