예제 #1
0
        public static DestructorDeclarationSyntax ToStatementBody(DestructorDeclarationSyntax method)
        {
            var body = method.ExpressionBody.Expression.WithLeadingTrivia(SyntaxFactory.Space);

            return(method.WithBody(SyntaxFactory.Block(SyntaxFactory.ExpressionStatement(body)))
                   .WithExpressionBody(null)
                   .WithSemicolonToken(SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken))
                   .WithTrailingTrivia(method.GetTrailingTrivia()));
        }
예제 #2
0
        public override SyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node)
        {
            BlockSyntax block = (BlockSyntax)SyntaxFactory.ParseStatement(emptyBody);

            return(node.WithBody(block));
        }