817 references to BinaryOperatorKind
GenerateDocumentationAndConfigFiles (60)
src\30958ef190fa2467\SyntaxGeneratorInternal.cs (1)
108public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (8)
247BinaryOperatorKind.Equals 248or BinaryOperatorKind.NotEquals 249or BinaryOperatorKind.ObjectValueEquals 250or BinaryOperatorKind.ObjectValueNotEquals 251or BinaryOperatorKind.LessThan 252or BinaryOperatorKind.LessThanOrEqual 253or BinaryOperatorKind.GreaterThan 254or BinaryOperatorKind.GreaterThanOrEqual => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 19new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 27{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 28{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 156BinaryOperatorKind.LessThanOrEqual or 157BinaryOperatorKind.GreaterThan or 158BinaryOperatorKind.GreaterThanOrEqual) 163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 164BinaryOperatorKind.And or 165BinaryOperatorKind.ConditionalAnd or 166BinaryOperatorKind.ConditionalOr) 172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 380BinaryOperatorKind operationKind, 385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 408BinaryOperatorKind operationKind) 418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
ILLink.RoslynAnalyzer (3)
DataFlow\FeatureChecksVisitor.cs (2)
102case BinaryOperatorKind.Equals: 105case BinaryOperatorKind.NotEquals:
TrimAnalysis\TrimAnalysisVisitor.cs (1)
200operation.OperatorKind == BinaryOperatorKind.Or &&
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (2)
139if (binaryOperation.OperatorKind == BinaryOperatorKind.Equals) 145else if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
Microsoft.CodeAnalysis (46)
Generated\Operations.Generated.cs (20)
1107BinaryOperatorKind OperatorKind { get; } 1516BinaryOperatorKind OperatorKind { get; } 2773BinaryOperatorKind Relation { get; } 2976BinaryOperatorKind OperatorKind { get; } 3531/// Kind of binary pattern; either <see cref="BinaryOperatorKind.And" /> or <see cref="BinaryOperatorKind.Or" />. 3533BinaryOperatorKind OperatorKind { get; } 3589BinaryOperatorKind OperatorKind { get; } 5682internal BinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, bool isLifted, bool isChecked, bool isCompareText, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IMethodSymbol? unaryOperatorMethod, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5697public BinaryOperatorKind OperatorKind { get; } 6346internal CompoundAssignmentOperation(IConvertibleConversion inConversion, IConvertibleConversion outConversion, BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6362public BinaryOperatorKind OperatorKind { get; } 8315internal RelationalCaseClauseOperation(IOperation value, BinaryOperatorKind relation, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8322public BinaryOperatorKind Relation { get; } 8632internal TupleBinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8640public BinaryOperatorKind OperatorKind { get; } 9929internal BinaryPatternOperation(BinaryOperatorKind operatorKind, IPatternOperation leftPattern, IPatternOperation rightPattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9936public BinaryOperatorKind OperatorKind { get; } 10011internal RelationalPatternOperation(BinaryOperatorKind operatorKind, IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10017public BinaryOperatorKind OperatorKind { get; }
Operations\ControlFlowGraphBuilder.cs (26)
2166case BinaryOperatorKind.ConditionalOr: 2167case BinaryOperatorKind.ConditionalAnd: 2283case BinaryOperatorKind.ConditionalOr: 2287case BinaryOperatorKind.ConditionalAnd: 2549new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or, 2639new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or, 4971isUp = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual, 5091var comparisonKind = BinaryOperatorKind.None; 5096comparisonKind = BinaryOperatorKind.LessThanOrEqual; 5103comparisonKind = BinaryOperatorKind.GreaterThanOrEqual; 5107comparisonKind = BinaryOperatorKind.LessThanOrEqual; 5114if (comparisonKind == BinaryOperatorKind.None && ITypeSymbolHelpers.IsSignedIntegralType(stepEnumUnderlyingTypeOrSelf)) 5116comparisonKind = BinaryOperatorKind.LessThanOrEqual; 5123if (comparisonKind != BinaryOperatorKind.None) 5162eitherLimitOrControlVariableIsNull = new BinaryOperation(BinaryOperatorKind.Or, 5203condition = new BinaryOperation(BinaryOperatorKind.LessThanOrEqual, 5223condition = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual, 5257var shiftedStep = new BinaryOperation(BinaryOperatorKind.RightShift, 5272return new BinaryOperation(BinaryOperatorKind.ExclusiveOr, 5344IOperation condition = new BinaryOperation(BinaryOperatorKind.Or, 5396IOperation increment = new BinaryOperation(BinaryOperatorKind.Add, 5590condition = new BinaryOperation(BinaryOperatorKind.Equals, 5640if (relationalValueClause.Relation == BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.Analyzers (77)
MetaAnalyzers\CompareSymbolsCorrectlyAnalyzer.cs (2)
128if (binary.OperatorKind is not BinaryOperatorKind.Equals and not BinaryOperatorKind.NotEquals)
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (1)
280if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
MetaAnalyzers\PreferIsKindAnalyzer.cs (2)
73if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals))
src\30958ef190fa2467\SyntaxGeneratorInternal.cs (1)
108public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (8)
25ImmutableHashSet<BinaryOperatorKind>.Empty, ImmutableHashSet<UnaryOperatorKind>.Empty, ImmutableHashSet<CaseKind>.Empty, ImmutableHashSet<ISymbol>.Empty, ImmutableHashSet<object>.Empty); 30private readonly ImmutableHashSet<BinaryOperatorKind> _distinctBinaryOperatorKinds; 43ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 69ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 95ImmutableHashSet<BinaryOperatorKind>.Builder? distinctBinaryOperatorKindsBuilder = null; 290distinctBinaryOperatorKindsBuilder != null ? distinctBinaryOperatorKindsBuilder.ToImmutable() : ImmutableHashSet<BinaryOperatorKind>.Empty, 348void countBinaryOperator(IOperation operation, BinaryOperatorKind operatorKind) 351distinctBinaryOperatorKindsBuilder ??= ImmutableHashSet.CreateBuilder<BinaryOperatorKind>();
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
337return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 338binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 340(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (8)
247BinaryOperatorKind.Equals 248or BinaryOperatorKind.NotEquals 249or BinaryOperatorKind.ObjectValueEquals 250or BinaryOperatorKind.ObjectValueNotEquals 251or BinaryOperatorKind.LessThan 252or BinaryOperatorKind.LessThanOrEqual 253or BinaryOperatorKind.GreaterThan 254or BinaryOperatorKind.GreaterThanOrEqual => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 19new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 27{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 28{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 156BinaryOperatorKind.LessThanOrEqual or 157BinaryOperatorKind.GreaterThan or 158BinaryOperatorKind.GreaterThanOrEqual) 163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 164BinaryOperatorKind.And or 165BinaryOperatorKind.ConditionalAnd or 166BinaryOperatorKind.ConditionalOr) 172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 380BinaryOperatorKind operationKind, 385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 408BinaryOperatorKind operationKind) 418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Microsoft.CodeAnalysis.AnalyzerUtilities (88)
src\1e7e9f16bf7f1945\ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs (4)
245var operationKind = operation.Kind == OperationKind.Increment ? BinaryOperatorKind.Add : BinaryOperatorKind.Subtract; 294mergedValue = mergedValue.MergeBinaryOperation(newValue, BinaryOperatorKind.Add, leftType: operation.Type, rightType: operation.Type, resultType: operation.Type);
src\683181b2796de991\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (4)
396(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals); 404(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals);
src\a172c07bebba4cd8\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (4)
453(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals); 461(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (8)
25ImmutableHashSet<BinaryOperatorKind>.Empty, ImmutableHashSet<UnaryOperatorKind>.Empty, ImmutableHashSet<CaseKind>.Empty, ImmutableHashSet<ISymbol>.Empty, ImmutableHashSet<object>.Empty); 30private readonly ImmutableHashSet<BinaryOperatorKind> _distinctBinaryOperatorKinds; 43ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 69ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 95ImmutableHashSet<BinaryOperatorKind>.Builder? distinctBinaryOperatorKindsBuilder = null; 290distinctBinaryOperatorKindsBuilder != null ? distinctBinaryOperatorKindsBuilder.ToImmutable() : ImmutableHashSet<BinaryOperatorKind>.Empty, 348void countBinaryOperator(IOperation operation, BinaryOperatorKind operatorKind) 351distinctBinaryOperatorKindsBuilder ??= ImmutableHashSet.CreateBuilder<BinaryOperatorKind>();
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
337return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 338binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 340(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (8)
247BinaryOperatorKind.Equals 248or BinaryOperatorKind.NotEquals 249or BinaryOperatorKind.ObjectValueEquals 250or BinaryOperatorKind.ObjectValueNotEquals 251or BinaryOperatorKind.LessThan 252or BinaryOperatorKind.LessThanOrEqual 253or BinaryOperatorKind.GreaterThan 254or BinaryOperatorKind.GreaterThanOrEqual => true,
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (46)
255BinaryOperatorKind binaryOperatorKind, 289private static bool TryMerge(object? value1, object? value2, BinaryOperatorKind binaryOperatorKind, ITypeSymbol? type1, ITypeSymbol? type2, ITypeSymbol? resultType, [NotNullWhen(returnValue: true)] out object? result) 408private static bool TryMerge(char value1, char value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 412case BinaryOperatorKind.Add: 413case BinaryOperatorKind.Concatenate: 422private static bool TryMerge(string value1, string value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 426case BinaryOperatorKind.Add: 427case BinaryOperatorKind.Concatenate: 436private static bool TryMerge(bool value1, bool value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 440case BinaryOperatorKind.And: 441case BinaryOperatorKind.ConditionalAnd: 445case BinaryOperatorKind.Or: 446case BinaryOperatorKind.ConditionalOr: 450case BinaryOperatorKind.Equals: 454case BinaryOperatorKind.NotEquals: 463private static bool TryMerge(ulong value1, ulong value2, BinaryOperatorKind binaryOperatorKind, out ulong result) 467case BinaryOperatorKind.Add: 471case BinaryOperatorKind.Subtract: 475case BinaryOperatorKind.Multiply: 479case BinaryOperatorKind.Divide: 488case BinaryOperatorKind.And: 492case BinaryOperatorKind.Or: 496case BinaryOperatorKind.Remainder: 500case BinaryOperatorKind.Power: 504case BinaryOperatorKind.LeftShift: 513case BinaryOperatorKind.RightShift: 522case BinaryOperatorKind.ExclusiveOr: 526case BinaryOperatorKind.Equals: 530case BinaryOperatorKind.NotEquals: 534case BinaryOperatorKind.LessThan: 538case BinaryOperatorKind.LessThanOrEqual: 542case BinaryOperatorKind.GreaterThan: 546case BinaryOperatorKind.GreaterThanOrEqual: 555private static bool TryMerge(double value1, double value2, BinaryOperatorKind binaryOperatorKind, out double result) 559case BinaryOperatorKind.Add: 563case BinaryOperatorKind.Subtract: 567case BinaryOperatorKind.Multiply: 571case BinaryOperatorKind.Divide: 580case BinaryOperatorKind.Remainder: 584case BinaryOperatorKind.Power: 588case BinaryOperatorKind.Equals: 592case BinaryOperatorKind.NotEquals: 596case BinaryOperatorKind.LessThan: 600case BinaryOperatorKind.LessThanOrEqual: 604case BinaryOperatorKind.GreaterThan: 608case BinaryOperatorKind.GreaterThanOrEqual:
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (6)
1796if (operation is IBinaryPatternOperation { OperatorKind: BinaryOperatorKind.Or } binaryOrOperation) 1814if (operation is IBinaryPatternOperation { OperatorKind: BinaryOperatorKind.And } binaryOrOperation) 1872case BinaryOperatorKind.Equals: 1873case BinaryOperatorKind.ObjectValueEquals: 1877case BinaryOperatorKind.NotEquals: 1878case BinaryOperatorKind.ObjectValueNotEquals:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
Microsoft.CodeAnalysis.CodeStyle (15)
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
99if (binary.OperatorKind == BinaryOperatorKind.Equals) 105else if (binary.OperatorKind == BinaryOperatorKind.NotEquals)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (3)
66if (binaryPattern?.OperatorKind == BinaryOperatorKind.Or) 98BinaryOperatorKind.Or => IsDefault(binaryPattern.LeftPattern) || IsDefault(binaryPattern.RightPattern), 100BinaryOperatorKind.And => IsDefault(binaryPattern.LeftPattern) && IsDefault(binaryPattern.RightPattern),
src\roslyn\src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\roslyn\src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (2)
163if (current is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals } binaryOperation)
src\roslyn\src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
219if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
Microsoft.CodeAnalysis.CodeStyle.Fixes (48)
src\30958ef190fa2467\SyntaxGeneratorInternal.cs (1)
108public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 19new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 27{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 28{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 156BinaryOperatorKind.LessThanOrEqual or 157BinaryOperatorKind.GreaterThan or 158BinaryOperatorKind.GreaterThanOrEqual) 163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 164BinaryOperatorKind.And or 165BinaryOperatorKind.ConditionalAnd or 166BinaryOperatorKind.ConditionalOr) 172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 380BinaryOperatorKind operationKind, 385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 408BinaryOperatorKind operationKind) 418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Microsoft.CodeAnalysis.CSharp (28)
Operations\CSharpOperationFactory_Methods.cs (21)
547internal static BinaryOperatorKind DeriveBinaryOperatorKind(CSharp.BinaryOperatorKind operatorKind) 552return BinaryOperatorKind.Add; 555return BinaryOperatorKind.Subtract; 558return BinaryOperatorKind.Multiply; 561return BinaryOperatorKind.Divide; 564return BinaryOperatorKind.Remainder; 567return BinaryOperatorKind.LeftShift; 570return BinaryOperatorKind.RightShift; 573return BinaryOperatorKind.UnsignedRightShift; 576return BinaryOperatorKind.And; 579return BinaryOperatorKind.Or; 582return BinaryOperatorKind.ExclusiveOr; 585return BinaryOperatorKind.LessThan; 588return BinaryOperatorKind.LessThanOrEqual; 591return BinaryOperatorKind.Equals; 594return BinaryOperatorKind.NotEquals; 597return BinaryOperatorKind.GreaterThanOrEqual; 600return BinaryOperatorKind.GreaterThan; 603return BinaryOperatorKind.ConditionalAnd; 606return BinaryOperatorKind.ConditionalOr; 609return BinaryOperatorKind.None;
Operations\CSharpOperationFactory.cs (7)
1434BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundCompoundAssignmentOperator.Operator.Kind); 1560BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind); 1584BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind); 1631BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundTupleBinaryOperator.OperatorKind); 2593BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundRelationalPattern.Relation); 2739boundBinaryPattern.Disjunction ? BinaryOperatorKind.Or : BinaryOperatorKind.And,
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
55if (operation is IBinaryOperation { OperatorKind: BinaryOperatorKind.Subtract } binaryOperation)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (12)
100internal sealed class Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : AnalyzedPattern(target) 102public readonly BinaryOperatorKind OperatorKind = operatorKind; 184private static BinaryOperatorKind Negate(BinaryOperatorKind kind) 188BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, 189BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, 190BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, 191BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (5)
11using static BinaryOperatorKind; 43case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 124private static bool IsRelationalOperator(BinaryOperatorKind operatorKind) 146public static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1088private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 1104var opName = operatorKind == BinaryOperatorKind.Equals
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
158OperatorKind: BinaryOperatorKind.Equals, 663var expectedKind = successRequirement 664? BinaryOperatorKind.NotEquals 665: BinaryOperatorKind.Equals; 738(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 745(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 752OperatorKind: BinaryOperatorKind.Equals, 760OperatorKind: BinaryOperatorKind.NotEquals, 804OperatorKind: BinaryOperatorKind.ConditionalAnd, 816OperatorKind: BinaryOperatorKind.ConditionalOr,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (5)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (3)
193public override SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right) 196BinaryOperatorKind.Equals => generator.ReferenceEqualsExpression(left, right), 197BinaryOperatorKind.NotEquals => generator.ReferenceNotEqualsExpression(left, right),
Microsoft.CodeAnalysis.CSharp.Features (38)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (5)
22private static readonly Dictionary<BinaryOperatorKind, SyntaxKind> s_operatorMap = new() 24{ BinaryOperatorKind.LessThan, SyntaxKind.LessThanToken }, 25{ BinaryOperatorKind.GreaterThan, SyntaxKind.GreaterThanToken }, 26{ BinaryOperatorKind.LessThanOrEqual, SyntaxKind.LessThanEqualsToken }, 27{ BinaryOperatorKind.GreaterThanOrEqual, SyntaxKind.GreaterThanEqualsToken },
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
55if (operation is IBinaryOperation { OperatorKind: BinaryOperatorKind.Subtract } binaryOperation)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (12)
100internal sealed class Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : AnalyzedPattern(target) 102public readonly BinaryOperatorKind OperatorKind = operatorKind; 184private static BinaryOperatorKind Negate(BinaryOperatorKind kind) 188BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, 189BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, 190BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, 191BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (5)
11using static BinaryOperatorKind; 43case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 124private static bool IsRelationalOperator(BinaryOperatorKind operatorKind) 146public static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
158OperatorKind: BinaryOperatorKind.Equals, 663var expectedKind = successRequirement 664? BinaryOperatorKind.NotEquals 665: BinaryOperatorKind.Equals; 738(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 745(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 752OperatorKind: BinaryOperatorKind.Equals, 760OperatorKind: BinaryOperatorKind.NotEquals, 804OperatorKind: BinaryOperatorKind.ConditionalAnd, 816OperatorKind: BinaryOperatorKind.ConditionalOr,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (5)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken,
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (1)
Microsoft.NetCore.Analyzers\Runtime\CSharpUseSpanBasedStringConcat.cs (1)
21return operation.OperatorKind == BinaryOperatorKind.Add &&
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1088private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 1104var opName = operatorKind == BinaryOperatorKind.Equals
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (3)
193public override SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right) 196BinaryOperatorKind.Equals => generator.ReferenceEqualsExpression(left, right), 197BinaryOperatorKind.NotEquals => generator.ReferenceNotEqualsExpression(left, right),
Microsoft.CodeAnalysis.Features (26)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.AnalyzedNodes.cs (2)
77internal sealed class Relational(BinaryOperatorKind operatorKind, TExpressionSyntax value) : AnalyzedPattern 79public readonly BinaryOperatorKind OperatorKind = operatorKind;
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (5)
15using static BinaryOperatorKind; 286case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 416private static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind) 429private static bool IsRelationalOperator(BinaryOperatorKind operatorKind)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (8)
307if (condition is IBinaryOperation { OperatorKind: BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual or BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual } binaryOperator && 320OperatorKind: BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual or BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual,
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
99if (binary.OperatorKind == BinaryOperatorKind.Equals) 105else if (binary.OperatorKind == BinaryOperatorKind.NotEquals)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (3)
66if (binaryPattern?.OperatorKind == BinaryOperatorKind.Or) 98BinaryOperatorKind.Or => IsDefault(binaryPattern.LeftPattern) || IsDefault(binaryPattern.RightPattern), 100BinaryOperatorKind.And => IsDefault(binaryPattern.LeftPattern) && IsDefault(binaryPattern.RightPattern),
src\roslyn\src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\roslyn\src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (2)
163if (current is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals } binaryOperation)
src\roslyn\src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
219if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.NetAnalyzers (172)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumShouldNotHaveDuplicatedValues.cs (1)
123case IBinaryOperation { OperatorKind: not BinaryOperatorKind.Or }:
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidLengthCalculationWhenSlicingToEnd.cs (3)
96IBinaryOperation { OperatorKind: BinaryOperatorKind.Add or BinaryOperatorKind.Subtract } binaryOperation 139AddExpressionPartToSet(binaryOperation.RightOperand, binaryOperation.OperatorKind == BinaryOperatorKind.Subtract ? !isNegated : isNegated, set);
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.cs (6)
1775(bo.OperatorKind == BinaryOperatorKind.Equals || 1776bo.OperatorKind == BinaryOperatorKind.NotEquals || 1777bo.OperatorKind == BinaryOperatorKind.GreaterThan || 1778bo.OperatorKind == BinaryOperatorKind.LessThan || 1779bo.OperatorKind == BinaryOperatorKind.GreaterThanOrEqual || 1780bo.OperatorKind == BinaryOperatorKind.LessThanOrEqual);
Microsoft.NetCore.Analyzers\Performance\PreferDictionaryTryMethodsOverContainsKeyGuardAnalyzer.cs (2)
293case IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } bAnd when guardsTruePath: 303case IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } bOr when !guardsTruePath:
Microsoft.NetCore.Analyzers\Performance\RecommendCaseInsensitiveStringComparison.Analyzer.cs (2)
300if (binaryOperation.OperatorKind is not BinaryOperatorKind.Equals and not BinaryOperatorKind.NotEquals)
Microsoft.NetCore.Analyzers\Performance\RecommendCaseInsensitiveStringComparison.Fixer.cs (1)
207var replacement = binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals ?
Microsoft.NetCore.Analyzers\Performance\UseCountProperly.cs (19)
343if (negatedPattern.Pattern is IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.GreaterThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } } 344or IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.GreaterThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } }) 353or IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.LessThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } }; 368if (relationalPattern is { OperatorKind: BinaryOperatorKind.LessThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } } 369or { OperatorKind: BinaryOperatorKind.LessThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } }) 377return relationalPattern is { OperatorKind: BinaryOperatorKind.GreaterThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } } 378or { OperatorKind: BinaryOperatorKind.GreaterThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } }; 575case BinaryOperatorKind.Equals: 576case BinaryOperatorKind.LessThanOrEqual: 579case BinaryOperatorKind.NotEquals: 580case BinaryOperatorKind.GreaterThan: 591case BinaryOperatorKind.LessThan: 594case BinaryOperatorKind.GreaterThanOrEqual: 623case BinaryOperatorKind.Equals: 624case BinaryOperatorKind.GreaterThanOrEqual: 628case BinaryOperatorKind.LessThan: 629case BinaryOperatorKind.NotEquals: 641case BinaryOperatorKind.LessThanOrEqual: 645case BinaryOperatorKind.GreaterThan:
Microsoft.NetCore.Analyzers\Performance\UseStartsWithInsteadOfIndexOfComparisonWithZero.cs (3)
99if (binaryOperation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 107if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
Microsoft.NetCore.Analyzers\Runtime\LoggerMessageDefineAnalyzer.cs (1)
258case IBinaryOperation { OperatorKind: BinaryOperatorKind.Add } binary:
Microsoft.NetCore.Analyzers\Runtime\PreferStringContainsOverIndexOf.Fixer.cs (1)
125SyntaxNode newIfCondition = binaryOperation.OperatorKind == BinaryOperatorKind.Equals && (int)otherOperation.ConstantValue.Value! == -1 ?
Microsoft.NetCore.Analyzers\Runtime\PreferStringContainsOverIndexOfAnalyzer.cs (4)
176var operatorKind = binaryOperation.OperatorKind; 179if ((operatorKind == BinaryOperatorKind.Equals && intValue < 0) || 180(operatorKind == BinaryOperatorKind.GreaterThanOrEqual && intValue == 0) || 181(operatorKind == BinaryOperatorKind.NotEquals && intValue < 0))
Microsoft.NetCore.Analyzers\Runtime\TestForEmptyStringsUsingStringLength.cs (2)
102if (binaryOperation.OperatorKind is not BinaryOperatorKind.Equals and 103not BinaryOperatorKind.NotEquals)
Microsoft.NetCore.Analyzers\Runtime\TestForNaNCorrectly.cs (7)
36private readonly BinaryOperatorKind[] _comparisonOperators = new[] 38BinaryOperatorKind.Equals, 39BinaryOperatorKind.GreaterThan, 40BinaryOperatorKind.GreaterThanOrEqual, 41BinaryOperatorKind.LessThan, 42BinaryOperatorKind.LessThanOrEqual, 43BinaryOperatorKind.NotEquals
Microsoft.NetCore.Analyzers\Runtime\UseExceptionThrowHelpers.cs (26)
376else if (condition is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } equalsOp) 407else if (condition is IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp && 409orOp.RightOperand is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } lengthCheckOperation) 475case BinaryOperatorKind.Equals: 494case BinaryOperatorKind.LessThanOrEqual or BinaryOperatorKind.LessThan: 500methodName = binaryOperation.OperatorKind == BinaryOperatorKind.LessThanOrEqual ? ThrowIfNegativeOrZero : ThrowIfNegative; 507case BinaryOperatorKind.GreaterThanOrEqual or BinaryOperatorKind.GreaterThan: 513methodName = binaryOperation.OperatorKind == BinaryOperatorKind.GreaterThanOrEqual ? ThrowIfNegativeOrZero : ThrowIfNegative; 541case BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual or BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual or BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals: 552BinaryOperatorKind.GreaterThan => ThrowIfGreaterThan, 553BinaryOperatorKind.GreaterThanOrEqual => ThrowIfGreaterThanOrEqual, 554BinaryOperatorKind.LessThan => ThrowIfLessThan, 555BinaryOperatorKind.LessThanOrEqual => ThrowIfLessThanOrEqual, 556BinaryOperatorKind.Equals => ThrowIfEqual, 574BinaryOperatorKind.GreaterThan => ThrowIfLessThan, 575BinaryOperatorKind.GreaterThanOrEqual => ThrowIfLessThanOrEqual, 576BinaryOperatorKind.LessThan => ThrowIfGreaterThan, 577BinaryOperatorKind.LessThanOrEqual => ThrowIfGreaterThanOrEqual, 578BinaryOperatorKind.Equals => ThrowIfEqual,
Microsoft.NetCore.Analyzers\Runtime\UseSpanBasedStringConcat.cs (2)
121private BinaryOperatorKind _operatorKind; 134if (_operatorKind is BinaryOperatorKind.None)
Microsoft.NetCore.Analyzers\Runtime\UseSpanBasedStringConcat.Fixer.cs (2)
52|| concatOperation.OperatorKind is not (BinaryOperatorKind.Add or BinaryOperatorKind.Concatenate))
Microsoft.NetCore.Analyzers\Runtime\UseStringEqualsOverStringCompare.cs (2)
183if (binaryOperation?.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals))
Microsoft.NetCore.Analyzers\Runtime\UseStringEqualsOverStringCompare.Fixer.cs (1)
129return b.OperatorKind is BinaryOperatorKind.NotEquals
Microsoft.NetCore.Analyzers\Security\DoNotUseDeprecatedSecurityProtocols.cs (1)
232return compoundAssignmentOperation.OperatorKind == BinaryOperatorKind.And
src\440320f3f10733a8\ValueContentAbstractValue.cs (46)
254BinaryOperatorKind binaryOperatorKind, 288private static bool TryMerge(object? value1, object? value2, BinaryOperatorKind binaryOperatorKind, ITypeSymbol? type1, ITypeSymbol? type2, ITypeSymbol? resultType, [NotNullWhen(returnValue: true)] out object? result) 407private static bool TryMerge(char value1, char value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 411case BinaryOperatorKind.Add: 412case BinaryOperatorKind.Concatenate: 421private static bool TryMerge(string value1, string value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 425case BinaryOperatorKind.Add: 426case BinaryOperatorKind.Concatenate: 435private static bool TryMerge(bool value1, bool value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result) 439case BinaryOperatorKind.And: 440case BinaryOperatorKind.ConditionalAnd: 444case BinaryOperatorKind.Or: 445case BinaryOperatorKind.ConditionalOr: 449case BinaryOperatorKind.Equals: 453case BinaryOperatorKind.NotEquals: 462private static bool TryMerge(ulong value1, ulong value2, BinaryOperatorKind binaryOperatorKind, out ulong result) 466case BinaryOperatorKind.Add: 470case BinaryOperatorKind.Subtract: 474case BinaryOperatorKind.Multiply: 478case BinaryOperatorKind.Divide: 487case BinaryOperatorKind.And: 491case BinaryOperatorKind.Or: 495case BinaryOperatorKind.Remainder: 499case BinaryOperatorKind.Power: 503case BinaryOperatorKind.LeftShift: 512case BinaryOperatorKind.RightShift: 521case BinaryOperatorKind.ExclusiveOr: 525case BinaryOperatorKind.Equals: 529case BinaryOperatorKind.NotEquals: 533case BinaryOperatorKind.LessThan: 537case BinaryOperatorKind.LessThanOrEqual: 541case BinaryOperatorKind.GreaterThan: 545case BinaryOperatorKind.GreaterThanOrEqual: 554private static bool TryMerge(double value1, double value2, BinaryOperatorKind binaryOperatorKind, out double result) 558case BinaryOperatorKind.Add: 562case BinaryOperatorKind.Subtract: 566case BinaryOperatorKind.Multiply: 570case BinaryOperatorKind.Divide: 579case BinaryOperatorKind.Remainder: 583case BinaryOperatorKind.Power: 587case BinaryOperatorKind.Equals: 591case BinaryOperatorKind.NotEquals: 595case BinaryOperatorKind.LessThan: 599case BinaryOperatorKind.LessThanOrEqual: 603case BinaryOperatorKind.GreaterThan: 607case BinaryOperatorKind.GreaterThanOrEqual:
src\440320f3f10733a8\ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs (4)
244var operationKind = operation.Kind == OperationKind.Increment ? BinaryOperatorKind.Add : BinaryOperatorKind.Subtract; 293mergedValue = mergedValue.MergeBinaryOperation(newValue, BinaryOperatorKind.Add, leftType: operation.Type, rightType: operation.Type, resultType: operation.Type);
src\47c588c5b8785708\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (4)
394(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals); 402(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals);
src\afc74d572e54ec72\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (4)
450(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals); 458(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (8)
27ImmutableHashSet<BinaryOperatorKind>.Empty, ImmutableHashSet<UnaryOperatorKind>.Empty, ImmutableHashSet<CaseKind>.Empty, ImmutableHashSet<ISymbol>.Empty, ImmutableHashSet<object>.Empty); 32private readonly ImmutableHashSet<BinaryOperatorKind> _distinctBinaryOperatorKinds; 45ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 71ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 97ImmutableHashSet<BinaryOperatorKind>.Builder? distinctBinaryOperatorKindsBuilder = null; 292distinctBinaryOperatorKindsBuilder != null ? distinctBinaryOperatorKindsBuilder.ToImmutable() : ImmutableHashSet<BinaryOperatorKind>.Empty, 350void countBinaryOperator(IOperation operation, BinaryOperatorKind operatorKind) 353distinctBinaryOperatorKindsBuilder ??= ImmutableHashSet.CreateBuilder<BinaryOperatorKind>();
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
339return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 340binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 342(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IOperationExtensions.cs (10)
400BinaryOperatorKind.Equals 401or BinaryOperatorKind.NotEquals 402or BinaryOperatorKind.ObjectValueEquals 403or BinaryOperatorKind.ObjectValueNotEquals 404or BinaryOperatorKind.LessThan 405or BinaryOperatorKind.LessThanOrEqual 406or BinaryOperatorKind.GreaterThan 407or BinaryOperatorKind.GreaterThanOrEqual => true, 421case BinaryOperatorKind.Add: 423case BinaryOperatorKind.Subtract:
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (6)
1793if (operation is IBinaryPatternOperation { OperatorKind: BinaryOperatorKind.Or } binaryOrOperation) 1811if (operation is IBinaryPatternOperation { OperatorKind: BinaryOperatorKind.And } binaryOrOperation) 1869case BinaryOperatorKind.Equals: 1870case BinaryOperatorKind.ObjectValueEquals: 1874case BinaryOperatorKind.NotEquals: 1875case BinaryOperatorKind.ObjectValueNotEquals:
Microsoft.CodeAnalysis.ResxSourceGenerator (24)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (8)
25ImmutableHashSet<BinaryOperatorKind>.Empty, ImmutableHashSet<UnaryOperatorKind>.Empty, ImmutableHashSet<CaseKind>.Empty, ImmutableHashSet<ISymbol>.Empty, ImmutableHashSet<object>.Empty); 30private readonly ImmutableHashSet<BinaryOperatorKind> _distinctBinaryOperatorKinds; 43ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 69ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 95ImmutableHashSet<BinaryOperatorKind>.Builder? distinctBinaryOperatorKindsBuilder = null; 290distinctBinaryOperatorKindsBuilder != null ? distinctBinaryOperatorKindsBuilder.ToImmutable() : ImmutableHashSet<BinaryOperatorKind>.Empty, 348void countBinaryOperator(IOperation operation, BinaryOperatorKind operatorKind) 351distinctBinaryOperatorKindsBuilder ??= ImmutableHashSet.CreateBuilder<BinaryOperatorKind>();
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
337return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 338binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 340(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (8)
247BinaryOperatorKind.Equals 248or BinaryOperatorKind.NotEquals 249or BinaryOperatorKind.ObjectValueEquals 250or BinaryOperatorKind.ObjectValueNotEquals 251or BinaryOperatorKind.LessThan 252or BinaryOperatorKind.LessThanOrEqual 253or BinaryOperatorKind.GreaterThan 254or BinaryOperatorKind.GreaterThanOrEqual => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (3)
174Public Overrides Function NegateEquality(generator As SyntaxGenerator, node As SyntaxNode, left As SyntaxNode, negatedKind As Operations.BinaryOperatorKind, right As SyntaxNode) As SyntaxNode 176Case BinaryOperatorKind.Equals 180Case BinaryOperatorKind.NotEquals
Microsoft.CodeAnalysis.VisualBasic.Features (7)
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.Rewriting.vb (7)
13Private Shared ReadOnly s_operatorMap As Dictionary(Of BinaryOperatorKind, (CaseClauseKind As SyntaxKind, OperatorTokenKind As SyntaxKind)) = 14New Dictionary(Of BinaryOperatorKind, (SyntaxKind, SyntaxKind))() From 16{BinaryOperatorKind.NotEquals, (SyntaxKind.CaseNotEqualsClause, SyntaxKind.LessThanGreaterThanToken)}, 17{BinaryOperatorKind.LessThan, (SyntaxKind.CaseLessThanClause, SyntaxKind.LessThanToken)}, 18{BinaryOperatorKind.GreaterThan, (SyntaxKind.CaseGreaterThanClause, SyntaxKind.GreaterThanToken)}, 19{BinaryOperatorKind.LessThanOrEqual, (SyntaxKind.CaseLessThanOrEqualClause, SyntaxKind.LessThanEqualsToken)}, 20{BinaryOperatorKind.GreaterThanOrEqual, (SyntaxKind.CaseGreaterThanOrEqualClause, SyntaxKind.GreaterThanEqualsToken)}
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (1)
Microsoft.NetCore.Analyzers\Runtime\BasicUseSpanBasedStringConcat.vb (1)
30Return operation.OperatorKind = BinaryOperatorKind.Concatenate
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (3)
174Public Overrides Function NegateEquality(generator As SyntaxGenerator, node As SyntaxNode, left As SyntaxNode, negatedKind As Operations.BinaryOperatorKind, right As SyntaxNode) As SyntaxNode 176Case BinaryOperatorKind.Equals 180Case BinaryOperatorKind.NotEquals
Microsoft.CodeAnalysis.Workspaces (52)
src\30958ef190fa2467\SyntaxGeneratorInternal.cs (1)
108public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 19new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 27{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 28{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 156BinaryOperatorKind.LessThanOrEqual or 157BinaryOperatorKind.GreaterThan or 158BinaryOperatorKind.GreaterThanOrEqual) 163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 164BinaryOperatorKind.And or 165BinaryOperatorKind.ConditionalAnd or 166BinaryOperatorKind.ConditionalOr) 172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 380BinaryOperatorKind operationKind, 385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 408BinaryOperatorKind operationKind) 418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Roslyn.Diagnostics.Analyzers (72)
src\30958ef190fa2467\SyntaxGeneratorInternal.cs (1)
108public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (8)
25ImmutableHashSet<BinaryOperatorKind>.Empty, ImmutableHashSet<UnaryOperatorKind>.Empty, ImmutableHashSet<CaseKind>.Empty, ImmutableHashSet<ISymbol>.Empty, ImmutableHashSet<object>.Empty); 30private readonly ImmutableHashSet<BinaryOperatorKind> _distinctBinaryOperatorKinds; 43ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 69ImmutableHashSet<BinaryOperatorKind> distinctBinaryOperatorKinds, 95ImmutableHashSet<BinaryOperatorKind>.Builder? distinctBinaryOperatorKindsBuilder = null; 290distinctBinaryOperatorKindsBuilder != null ? distinctBinaryOperatorKindsBuilder.ToImmutable() : ImmutableHashSet<BinaryOperatorKind>.Empty, 348void countBinaryOperator(IOperation operation, BinaryOperatorKind operatorKind) 351distinctBinaryOperatorKindsBuilder ??= ImmutableHashSet.CreateBuilder<BinaryOperatorKind>();
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
337return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 338binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 340(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (8)
247BinaryOperatorKind.Equals 248or BinaryOperatorKind.NotEquals 249or BinaryOperatorKind.ObjectValueEquals 250or BinaryOperatorKind.ObjectValueNotEquals 251or BinaryOperatorKind.LessThan 252or BinaryOperatorKind.LessThanOrEqual 253or BinaryOperatorKind.GreaterThan 254or BinaryOperatorKind.GreaterThanOrEqual => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 19new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 27{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 28{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 156BinaryOperatorKind.LessThanOrEqual or 157BinaryOperatorKind.GreaterThan or 158BinaryOperatorKind.GreaterThanOrEqual) 163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 164BinaryOperatorKind.And or 165BinaryOperatorKind.ConditionalAnd or 166BinaryOperatorKind.ConditionalOr) 172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 380BinaryOperatorKind operationKind, 385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 408BinaryOperatorKind operationKind) 418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Roslyn.Diagnostics.CSharp.Analyzers (5)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1088private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 1104var opName = operatorKind == BinaryOperatorKind.Equals
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (3)
193public override SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right) 196BinaryOperatorKind.Equals => generator.ReferenceEqualsExpression(left, right), 197BinaryOperatorKind.NotEquals => generator.ReferenceNotEqualsExpression(left, right),
Roslyn.Diagnostics.VisualBasic.Analyzers (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (3)
174Public Overrides Function NegateEquality(generator As SyntaxGenerator, node As SyntaxNode, left As SyntaxNode, negatedKind As Operations.BinaryOperatorKind, right As SyntaxNode) As SyntaxNode 176Case BinaryOperatorKind.Equals 180Case BinaryOperatorKind.NotEquals