public static bool CanRefactor( SwitchStatementSyntax switchStatement, SemanticModel semanticModel, CancellationToken cancellationToken) { ExpressionSyntax expression = switchStatement.Expression; if (expression != null && IsEmptyOrContainsOnlyDefaultSection(switchStatement)) { ISymbol symbol = semanticModel.GetSymbol(expression, cancellationToken); if (symbol?.IsErrorType() == false) { ITypeSymbol typeSymbol = semanticModel.GetTypeSymbol(expression, cancellationToken); if (typeSymbol?.IsEnum() == true && typeSymbol.ExistsField()) { return(true); } } } return(false); }