Sdílet prostřednictvím


CSharpSyntaxRewriter Class

Definition

Represents a CSharpSyntaxVisitor<TResult> which descends an entire CSharpSyntaxNode graph and may replace or remove visited SyntaxNodes in depth-first order.

public ref class CSharpSyntaxRewriter abstract : Microsoft::CodeAnalysis::CSharp::CSharpSyntaxVisitor<Microsoft::CodeAnalysis::SyntaxNode ^>
public abstract class CSharpSyntaxRewriter : Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor<Microsoft.CodeAnalysis.SyntaxNode>
type CSharpSyntaxRewriter = class
    inherit CSharpSyntaxVisitor<SyntaxNode>
Public MustInherit Class CSharpSyntaxRewriter
Inherits CSharpSyntaxVisitor(Of SyntaxNode)
Inheritance
CSharpSyntaxRewriter

Constructors

CSharpSyntaxRewriter(Boolean)

Properties

VisitIntoStructuredTrivia

Methods

DefaultVisit(SyntaxNode) (Inherited from CSharpSyntaxVisitor<TResult>)
Visit(SyntaxNode)
VisitAccessorDeclaration(AccessorDeclarationSyntax)
VisitAccessorList(AccessorListSyntax)
VisitAliasQualifiedName(AliasQualifiedNameSyntax)
VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax)
VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax)
VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax)
VisitArgument(ArgumentSyntax)
VisitArgumentList(ArgumentListSyntax)
VisitArrayCreationExpression(ArrayCreationExpressionSyntax)
VisitArrayRankSpecifier(ArrayRankSpecifierSyntax)
VisitArrayType(ArrayTypeSyntax)
VisitArrowExpressionClause(ArrowExpressionClauseSyntax)
VisitAssignmentExpression(AssignmentExpressionSyntax)
VisitAttribute(AttributeSyntax)
VisitAttributeArgument(AttributeArgumentSyntax)
VisitAttributeArgumentList(AttributeArgumentListSyntax)
VisitAttributeList(AttributeListSyntax)
VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax)
VisitAwaitExpression(AwaitExpressionSyntax)
VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax)
VisitBaseExpression(BaseExpressionSyntax)
VisitBaseExpressionTypeClause(BaseExpressionTypeClauseSyntax)
VisitBaseExpressionTypeClause(BaseExpressionTypeClauseSyntax)

Called when the visitor visits a BaseExpressionTypeClauseSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitBaseList(BaseListSyntax)
VisitBinaryExpression(BinaryExpressionSyntax)
VisitBinaryPattern(BinaryPatternSyntax)
VisitBinaryPattern(BinaryPatternSyntax)

Called when the visitor visits a BinaryPatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitBlock(BlockSyntax)
VisitBracketedArgumentList(BracketedArgumentListSyntax)
VisitBracketedParameterList(BracketedParameterListSyntax)
VisitBreakStatement(BreakStatementSyntax)
VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax)
VisitCaseSwitchLabel(CaseSwitchLabelSyntax)
VisitCastExpression(CastExpressionSyntax)
VisitCatchClause(CatchClauseSyntax)
VisitCatchDeclaration(CatchDeclarationSyntax)
VisitCatchFilterClause(CatchFilterClauseSyntax)
VisitCheckedExpression(CheckedExpressionSyntax)
VisitCheckedStatement(CheckedStatementSyntax)
VisitClassDeclaration(ClassDeclarationSyntax)
VisitClassOrStructConstraint(ClassOrStructConstraintSyntax)
VisitCollectionExpression(CollectionExpressionSyntax)
VisitCollectionExpression(CollectionExpressionSyntax)

Called when the visitor visits a CollectionExpressionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitCompilationUnit(CompilationUnitSyntax)
VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax)
VisitConditionalExpression(ConditionalExpressionSyntax)
VisitConstantPattern(ConstantPatternSyntax)
VisitConstructorConstraint(ConstructorConstraintSyntax)
VisitConstructorDeclaration(ConstructorDeclarationSyntax)
VisitConstructorInitializer(ConstructorInitializerSyntax)
VisitContinueStatement(ContinueStatementSyntax)
VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax)
VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax)
VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax)
VisitCrefParameter(CrefParameterSyntax)
VisitCrefParameterList(CrefParameterListSyntax)
VisitDeclarationExpression(DeclarationExpressionSyntax)
VisitDeclarationPattern(DeclarationPatternSyntax)
VisitDefaultConstraint(DefaultConstraintSyntax)
VisitDefaultConstraint(DefaultConstraintSyntax)

Called when the visitor visits a DefaultConstraintSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitDefaultExpression(DefaultExpressionSyntax)
VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax)
VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax)
VisitDelegateDeclaration(DelegateDeclarationSyntax)
VisitDestructorDeclaration(DestructorDeclarationSyntax)
VisitDiscardDesignation(DiscardDesignationSyntax)
VisitDiscardPattern(DiscardPatternSyntax)
VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax)
VisitDoStatement(DoStatementSyntax)
VisitElementAccessExpression(ElementAccessExpressionSyntax)
VisitElementBindingExpression(ElementBindingExpressionSyntax)
VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax)
VisitElseClause(ElseClauseSyntax)
VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax)
VisitEmptyStatement(EmptyStatementSyntax)
VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax)
VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax)
VisitEnumDeclaration(EnumDeclarationSyntax)
VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax)
VisitEqualsValueClause(EqualsValueClauseSyntax)
VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax)
VisitEventDeclaration(EventDeclarationSyntax)
VisitEventFieldDeclaration(EventFieldDeclarationSyntax)
VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax)
VisitExpressionColon(ExpressionColonSyntax)
VisitExpressionColon(ExpressionColonSyntax)

Called when the visitor visits a ExpressionColonSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitExpressionElement(ExpressionElementSyntax)
VisitExpressionElement(ExpressionElementSyntax)

Called when the visitor visits a ExpressionElementSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitExpressionStatement(ExpressionStatementSyntax)
VisitExternAliasDirective(ExternAliasDirectiveSyntax)
VisitFieldDeclaration(FieldDeclarationSyntax)
VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax)
VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax)

Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFinallyClause(FinallyClauseSyntax)
VisitFixedStatement(FixedStatementSyntax)
VisitForEachStatement(ForEachStatementSyntax)
VisitForEachVariableStatement(ForEachVariableStatementSyntax)
VisitForStatement(ForStatementSyntax)
VisitFromClause(FromClauseSyntax)
VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax)
VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax)

Called when the visitor visits a FunctionPointerCallingConventionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFunctionPointerParameter(FunctionPointerParameterSyntax)
VisitFunctionPointerParameter(FunctionPointerParameterSyntax)

Called when the visitor visits a FunctionPointerParameterSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax)
VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax)

Called when the visitor visits a FunctionPointerParameterListSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFunctionPointerType(FunctionPointerTypeSyntax)
VisitFunctionPointerType(FunctionPointerTypeSyntax)

Called when the visitor visits a FunctionPointerTypeSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax)
VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax)

Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax)
VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax)

Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitGenericName(GenericNameSyntax)
VisitGlobalStatement(GlobalStatementSyntax)
VisitGotoStatement(GotoStatementSyntax)
VisitGroupClause(GroupClauseSyntax)
VisitIdentifierName(IdentifierNameSyntax)
VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax)
VisitIfStatement(IfStatementSyntax)
VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax)
VisitImplicitElementAccess(ImplicitElementAccessSyntax)
VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax)
VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax)

Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax)
VisitIncompleteMember(IncompleteMemberSyntax)
VisitIndexerDeclaration(IndexerDeclarationSyntax)
VisitIndexerMemberCref(IndexerMemberCrefSyntax)
VisitInitializerExpression(InitializerExpressionSyntax)
VisitInterfaceDeclaration(InterfaceDeclarationSyntax)
VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax)
VisitInterpolatedStringText(InterpolatedStringTextSyntax)
VisitInterpolation(InterpolationSyntax)
VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax)
VisitInterpolationFormatClause(InterpolationFormatClauseSyntax)
VisitInvocationExpression(InvocationExpressionSyntax)
VisitIsPatternExpression(IsPatternExpressionSyntax)
VisitJoinClause(JoinClauseSyntax)
VisitJoinIntoClause(JoinIntoClauseSyntax)
VisitLabeledStatement(LabeledStatementSyntax)
VisitLetClause(LetClauseSyntax)
VisitLineDirectivePosition(LineDirectivePositionSyntax)
VisitLineDirectivePosition(LineDirectivePositionSyntax)

Called when the visitor visits a LineDirectivePositionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax)
VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax)
VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax)

Called when the visitor visits a LineSpanDirectiveTriviaSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitList(SyntaxTokenList)
VisitList(SyntaxTriviaList)
VisitList<TNode>(SeparatedSyntaxList<TNode>)
VisitList<TNode>(SyntaxList<TNode>)
VisitListElement(SyntaxTrivia)
VisitListElement<TNode>(TNode)
VisitListPattern(ListPatternSyntax)
VisitListPattern(ListPatternSyntax)

Called when the visitor visits a ListPatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitListSeparator(SyntaxToken)
VisitLiteralExpression(LiteralExpressionSyntax)
VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax)
VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax)
VisitLocalFunctionStatement(LocalFunctionStatementSyntax)
VisitLockStatement(LockStatementSyntax)
VisitMakeRefExpression(MakeRefExpressionSyntax)
VisitMemberAccessExpression(MemberAccessExpressionSyntax)
VisitMemberBindingExpression(MemberBindingExpressionSyntax)
VisitMethodDeclaration(MethodDeclarationSyntax)
VisitNameColon(NameColonSyntax)
VisitNameEquals(NameEqualsSyntax)
VisitNameMemberCref(NameMemberCrefSyntax)
VisitNamespaceDeclaration(NamespaceDeclarationSyntax)
VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax)
VisitNullableType(NullableTypeSyntax)
VisitObjectCreationExpression(ObjectCreationExpressionSyntax)
VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax)
VisitOmittedTypeArgument(OmittedTypeArgumentSyntax)
VisitOperatorDeclaration(OperatorDeclarationSyntax)
VisitOperatorMemberCref(OperatorMemberCrefSyntax)
VisitOrderByClause(OrderByClauseSyntax)
VisitOrdering(OrderingSyntax)
VisitParameter(ParameterSyntax)
VisitParameterList(ParameterListSyntax)
VisitParenthesizedExpression(ParenthesizedExpressionSyntax)
VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax)
VisitParenthesizedPattern(ParenthesizedPatternSyntax)
VisitParenthesizedPattern(ParenthesizedPatternSyntax)

Called when the visitor visits a ParenthesizedPatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax)
VisitPointerType(PointerTypeSyntax)
VisitPositionalPatternClause(PositionalPatternClauseSyntax)
VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax)
VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax)
VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax)
VisitPredefinedType(PredefinedTypeSyntax)
VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax)
VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax)
VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax)

Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitPropertyDeclaration(PropertyDeclarationSyntax)
VisitPropertyPatternClause(PropertyPatternClauseSyntax)
VisitQualifiedCref(QualifiedCrefSyntax)
VisitQualifiedName(QualifiedNameSyntax)
VisitQueryBody(QueryBodySyntax)
VisitQueryContinuation(QueryContinuationSyntax)
VisitQueryExpression(QueryExpressionSyntax)
VisitRangeExpression(RangeExpressionSyntax)
VisitRecordDeclaration(RecordDeclarationSyntax)
VisitRecordDeclaration(RecordDeclarationSyntax)

Called when the visitor visits a RecordDeclarationSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitRecursivePattern(RecursivePatternSyntax)
VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax)
VisitRefExpression(RefExpressionSyntax)
VisitRefType(RefTypeSyntax)
VisitRefTypeExpression(RefTypeExpressionSyntax)
VisitRefValueExpression(RefValueExpressionSyntax)
VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax)
VisitRelationalPattern(RelationalPatternSyntax)
VisitRelationalPattern(RelationalPatternSyntax)

Called when the visitor visits a RelationalPatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitReturnStatement(ReturnStatementSyntax)
VisitScopedType(ScopedTypeSyntax)
VisitScopedType(ScopedTypeSyntax)

Called when the visitor visits a ScopedTypeSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitSelectClause(SelectClauseSyntax)
VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax)
VisitSimpleBaseType(SimpleBaseTypeSyntax)
VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax)
VisitSingleVariableDesignation(SingleVariableDesignationSyntax)
VisitSizeOfExpression(SizeOfExpressionSyntax)
VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax)
VisitSlicePattern(SlicePatternSyntax)
VisitSlicePattern(SlicePatternSyntax)

Called when the visitor visits a SlicePatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitSpreadElement(SpreadElementSyntax)
VisitSpreadElement(SpreadElementSyntax)

Called when the visitor visits a SpreadElementSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax)
VisitStructDeclaration(StructDeclarationSyntax)
VisitSubpattern(SubpatternSyntax)
VisitSwitchExpression(SwitchExpressionSyntax)
VisitSwitchExpressionArm(SwitchExpressionArmSyntax)
VisitSwitchSection(SwitchSectionSyntax)
VisitSwitchStatement(SwitchStatementSyntax)
VisitThisExpression(ThisExpressionSyntax)
VisitThrowExpression(ThrowExpressionSyntax)
VisitThrowStatement(ThrowStatementSyntax)
VisitToken(SyntaxToken)
VisitTrivia(SyntaxTrivia)
VisitTryStatement(TryStatementSyntax)
VisitTupleElement(TupleElementSyntax)
VisitTupleExpression(TupleExpressionSyntax)
VisitTupleType(TupleTypeSyntax)
VisitTypeArgumentList(TypeArgumentListSyntax)
VisitTypeConstraint(TypeConstraintSyntax)
VisitTypeCref(TypeCrefSyntax)
VisitTypeOfExpression(TypeOfExpressionSyntax)
VisitTypeParameter(TypeParameterSyntax)
VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax)
VisitTypeParameterList(TypeParameterListSyntax)
VisitTypePattern(TypePatternSyntax)
VisitTypePattern(TypePatternSyntax)

Called when the visitor visits a TypePatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitUnaryPattern(UnaryPatternSyntax)
VisitUnaryPattern(UnaryPatternSyntax)

Called when the visitor visits a UnaryPatternSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax)
VisitUnsafeStatement(UnsafeStatementSyntax)
VisitUsingDirective(UsingDirectiveSyntax)
VisitUsingStatement(UsingStatementSyntax)
VisitVariableDeclaration(VariableDeclarationSyntax)
VisitVariableDeclarator(VariableDeclaratorSyntax)
VisitVarPattern(VarPatternSyntax)
VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax)
VisitWhenClause(WhenClauseSyntax)
VisitWhereClause(WhereClauseSyntax)
VisitWhileStatement(WhileStatementSyntax)
VisitWithExpression(WithExpressionSyntax)
VisitWithExpression(WithExpressionSyntax)

Called when the visitor visits a WithExpressionSyntax node.

(Inherited from CSharpSyntaxVisitor<TResult>)
VisitXmlCDataSection(XmlCDataSectionSyntax)
VisitXmlComment(XmlCommentSyntax)
VisitXmlCrefAttribute(XmlCrefAttributeSyntax)
VisitXmlElement(XmlElementSyntax)
VisitXmlElementEndTag(XmlElementEndTagSyntax)
VisitXmlElementStartTag(XmlElementStartTagSyntax)
VisitXmlEmptyElement(XmlEmptyElementSyntax)
VisitXmlName(XmlNameSyntax)
VisitXmlNameAttribute(XmlNameAttributeSyntax)
VisitXmlPrefix(XmlPrefixSyntax)
VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax)
VisitXmlText(XmlTextSyntax)
VisitXmlTextAttribute(XmlTextAttributeSyntax)
VisitYieldStatement(YieldStatementSyntax)

Applies to