diff --git a/src/Analyzers/CSharp/Analyzers/RemoveUnnecessaryParentheses/CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/RemoveUnnecessaryParentheses/CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs index 7e75cfc1109e9..8b183abf718a8 100644 --- a/src/Analyzers/CSharp/Analyzers/RemoveUnnecessaryParentheses/CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/RemoveUnnecessaryParentheses/CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs @@ -54,7 +54,7 @@ public static bool CanRemoveParenthesesHelper( ExpressionSyntax parentExpression; switch (parenthesizedExpression.Parent) { - case ConditionalExpressionSyntax _: + case ConditionalExpressionSyntax: // If our parent is a conditional, then only remove parens if the inner // expression is a primary. i.e. it's ok to remove any of the following: // diff --git a/src/Analyzers/Core/Analyzers/RemoveUnusedMembers/AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/RemoveUnusedMembers/AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs index ea5ce9e512387..2104187597c9e 100644 --- a/src/Analyzers/Core/Analyzers/RemoveUnusedMembers/AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/RemoveUnusedMembers/AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs @@ -534,7 +534,7 @@ private LocalizableString GetMessage( // IDE0052 has a different message for method and property symbols. switch (member) { - case IMethodSymbol _: + case IMethodSymbol: messageFormat = AnalyzersResources.Private_method_0_can_be_removed_as_it_is_never_invoked; break; @@ -663,8 +663,7 @@ private void AddDebuggerDisplayAttributeArguments(INamedTypeSymbol namedTypeSymb AddDebuggerDisplayAttributeArguments(nestedType, builder); break; - case IPropertySymbol _: - case IFieldSymbol _: + case IPropertySymbol or IFieldSymbol: AddDebuggerDisplayAttributeArgumentsCore(member, builder); break; } diff --git a/src/Features/CSharp/Portable/CodeFixes/GenerateType/GenerateTypeCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/GenerateType/GenerateTypeCodeFixProvider.cs index b7fb93904a8dc..5f4a347ab3c4d 100644 --- a/src/Features/CSharp/Portable/CodeFixes/GenerateType/GenerateTypeCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/GenerateType/GenerateTypeCodeFixProvider.cs @@ -47,12 +47,10 @@ protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnost { switch (node) { - case QualifiedNameSyntax _: + case QualifiedNameSyntax or MemberAccessExpressionSyntax: return true; case SimpleNameSyntax simple: return !simple.IsParentKind(SyntaxKind.QualifiedName); - case MemberAccessExpressionSyntax _: - return true; } return false; diff --git a/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs b/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs index 9cd285c0abee1..1e0195d297e03 100644 --- a/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs +++ b/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs @@ -290,7 +290,7 @@ private static bool CheckTopLevel(SyntaxNode node, TextSpan span) break; } - case GlobalStatementSyntax _: + case GlobalStatementSyntax: return true; case ConstructorInitializerSyntax constructorInitializer: return constructorInitializer.ContainsInArgument(span); diff --git a/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs b/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs index 275923aec259f..0e3ee36ac2166 100644 --- a/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs +++ b/src/Features/CSharp/Portable/QuickInfo/CSharpSemanticQuickInfoProvider.cs @@ -103,11 +103,11 @@ protected override NullableFlowState GetNullabilityAnalysis(SemanticModel semant case ILocalSymbol { HasConstantValue: true }: return default; // Symbols with useful quick info - case IFieldSymbol _: - case ILocalSymbol _: - case IParameterSymbol _: - case IPropertySymbol _: - case IRangeVariableSymbol _: + case IFieldSymbol: + case ILocalSymbol: + case IParameterSymbol: + case IPropertySymbol: + case IRangeVariableSymbol: break; default: diff --git a/src/VisualStudio/Core/Def/Workspace/VisualStudioTextUndoHistoryWorkspaceServiceFactory.cs b/src/VisualStudio/Core/Def/Workspace/VisualStudioTextUndoHistoryWorkspaceServiceFactory.cs index 2cc7c8ce17b37..3ea390c9fc4ad 100644 --- a/src/VisualStudio/Core/Def/Workspace/VisualStudioTextUndoHistoryWorkspaceServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Workspace/VisualStudioTextUndoHistoryWorkspaceServiceFactory.cs @@ -65,10 +65,8 @@ public bool TryGetTextUndoHistory(Workspace editorWorkspace, ITextBuffer textBuf break; - case MiscellaneousFilesWorkspace _: - + case MiscellaneousFilesWorkspace: // Nothing to do in this case: textBuffer is correct! - break; default: diff --git a/src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs b/src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs index cb88d9ebfcf3a..8b7163113b91b 100644 --- a/src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs +++ b/src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/NameSyntaxClassifier.cs @@ -208,11 +208,11 @@ private static bool TryClassifySymbol( token = name.GetNameToken(); classifiedSpan = new ClassifiedSpan(token.Span, GetClassificationForMethod(methodSymbol)); return true; - case IPropertySymbol _: + case IPropertySymbol: token = name.GetNameToken(); classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.PropertyName); return true; - case IEventSymbol _: + case IEventSymbol: token = name.GetNameToken(); classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.EventName); return true; @@ -229,7 +229,7 @@ private static bool TryClassifySymbol( token = name.GetNameToken(); classifiedSpan = new ClassifiedSpan(token.Span, GetClassificationForLocal(localSymbol)); return true; - case ILabelSymbol _: + case ILabelSymbol: token = name.GetNameToken(); classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.LabelName); return true; diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindLiterals/FindLiteralsSearchEngine.cs b/src/Workspaces/Core/Portable/FindSymbols/FindLiterals/FindLiteralsSearchEngine.cs index 7874ddb4d4df4..d489d306ed371 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindLiterals/FindLiteralsSearchEngine.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindLiterals/FindLiteralsSearchEngine.cs @@ -57,10 +57,10 @@ public FindLiteralsSearchEngine( _longValue = BitConverter.DoubleToInt64Bits(f); _searchKind = SearchKind.NumericLiterals; break; - case decimal _: // unsupported + case decimal: // unsupported _searchKind = SearchKind.None; break; - case char _: + case char: _longValue = IntegerUtilities.ToInt64(value); _searchKind = SearchKind.CharacterLiterals; break; diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs index c0ac6f521648d..7383f6e71739a 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs @@ -660,9 +660,9 @@ SymbolUsageInfo GetSymbolUsageInfoCommon() var operation = semanticModel.GetOperation(node, cancellationToken); switch (operation?.Parent) { - case INameOfOperation _: - case ITypeOfOperation _: - case ISizeOfOperation _: + case INameOfOperation: + case ITypeOfOperation: + case ISizeOfOperation: return SymbolUsageInfo.Create(ValueUsageInfo.Name); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ParenthesizedExpressionSyntaxExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ParenthesizedExpressionSyntaxExtensions.cs index 5ea6e1a52a234..e276008785309 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ParenthesizedExpressionSyntaxExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ParenthesizedExpressionSyntaxExtensions.cs @@ -739,16 +739,16 @@ public static OperatorPrecedence GetOperatorPrecedence(this PatternSyntax patter { switch (pattern) { - case ConstantPatternSyntax _: - case DiscardPatternSyntax _: - case DeclarationPatternSyntax _: - case RecursivePatternSyntax _: - case TypePatternSyntax _: - case VarPatternSyntax _: + case ConstantPatternSyntax: + case DiscardPatternSyntax: + case DeclarationPatternSyntax: + case RecursivePatternSyntax: + case TypePatternSyntax: + case VarPatternSyntax: return OperatorPrecedence.Primary; - case UnaryPatternSyntax _: - case RelationalPatternSyntax _: + case UnaryPatternSyntax: + case RelationalPatternSyntax: return OperatorPrecedence.Unary; case BinaryPatternSyntax binaryPattern: diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs index 3d07171076534..d5524bf1a9afe 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs @@ -112,7 +112,7 @@ public SyntaxNode GetImportContainer(SyntaxNode root, SyntaxNode? contextLocatio switch (import) { - case TExternSyntax _: + case TExternSyntax: return externContainer; case TUsingOrAliasSyntax u: if (IsAlias(u))