Пример #1
0
        public static void ComputeRefactoring(RefactoringContext context, LiteralExpressionSyntax literalExpression)
        {
            HexadecimalLiteralInfo info = SyntaxInfo.HexadecimalLiteralInfo(literalExpression);

            if (!info.Success)
            {
                return;
            }

            LiteralExpressionSyntax newLiteralExpression = CSharpFactory.LiteralExpression(info.Value);

            context.RegisterRefactoring(
                $"Replace '{info.Text}' with '{newLiteralExpression}'",
                cancellationToken => RefactorAsync(context.Document, literalExpression, newLiteralExpression, cancellationToken));
        }