public static void ComputeRefactoring(RefactoringContext context, LiteralExpressionSyntax literalExpression) { if (literalExpression.IsHexadecimalNumericLiteral()) { HexadecimalLiteralInfo info; if (HexadecimalLiteralInfo.TryCreate(literalExpression, out info)) { LiteralExpressionSyntax newLiteralExpression = info.ToDecimalLiteral(); context.RegisterRefactoring( $"Replace '{info.Text}' with '{newLiteralExpression}'", cancellationToken => RefactorAsync(context.Document, literalExpression, newLiteralExpression, cancellationToken)); } } }
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)); }