public static async Task <bool> CanRefactorAsync( RefactoringContext context, FieldDeclarationSyntax declaration) { TypeSyntax type = declaration.Declaration?.Type; if (type != null && declaration.Declaration.Variables.All(f => f.Initializer != null)) { SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false); ITypeSymbol typeSymbol = semanticModel.GetTypeInfo(type, context.CancellationToken).Type; return(typeSymbol != null && typeSymbol.CanBeConstantValue()); } return(false); }